LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-07-2018, 12:21 PM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
ssh stops listening when trying to configure sftp


I'm running Ubuntu 14.04.5. I'm trying to configure some sftp restrictions (1:6.6p1-2ubuntu2.10). I've added this to the ssh config file:

Code:
Subsystem sftp internal-sftp
Match Group sftp
  ChrootDirectory "/var/www"
  ForceCommand internal-sftp
  AllowTcpForwarding no
  X11Forwarding no
If I restart the ssh service (while connected through ssh), the ssh process is seemingly restarted (the current ssh connection is, of course, being kept alive), but it isn't listening to its port.
If I delete the abovementioned code (with the exception of the first line - i.e. sftp by itself works as it is), it works as expected and when I restart the ssh service, the PID is also mentioned:
Code:
ssh stop/waiting
ssh start/running, process 1597
I don't know what I'm misconfiguring. I can't see any relevant logs in auth.log of rsyslog.
On auth I can only see:
Code:
Received signal 15; terminating.
Server listening on 0.0.0.0 port 2223.
That happens when sftp chroot/matchgroup is not configured. Otherwise, it just says "Received signal 15; terminating".
 
Old 10-07-2018, 12:43 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
Make sure there are not any problems with the SSH server's configuration. You might have the SFTP subsystem defined twice by accident or something else wrong:

Code:
sudo /usr/sbin/sshd -T
echo $?
 
1 members found this post helpful.
Old 10-07-2018, 12:49 PM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
It was a silly mistake, but only pointed out by sshd -T command.
Quote:
Match Group sftp
ChrootDirectory "/var/www"
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
/etc/ssh/sshd_config line 95: Directive 'UsePAM' is not allowed within a Match block

I placed the directive about the "Match..." line and it works as expected. I'm just surprised that ssh didn't say anything about it. Maybe because it needed to keep the session going (as I was connected to the ssh). Thanks! Works fine now.
[later: ] I ended the match block with "Match all", as suggested by someone. I'm not 100% sure this is going to do the trick, i.e. work as expected, but ssh does restart properly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Tomcat6 stops listening when i change from port 8080 Droa Linux - Server 7 07-26-2012 03:56 PM
LXer: Restricting Users To SFTP Plus Setting Up Chrooted SSH/SFTP (Debian Squeeze) LXer Syndicated Linux News 0 09-06-2011 07:10 AM
configure ssh authentication using password file and sftp/scp authentication using ld cameliab Linux - Software 1 08-29-2011 03:28 AM
FC3 wireless print server stops listening?? jetsam Linux - Wireless Networking 2 04-18-2006 08:42 PM
Poftpd stops listening after a while and has to be reloaded bripage Linux - Networking 2 04-04-2002 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration