I am attempting to chroot jail using the /etc/ssh/sshd_config
file. My FTP server is vsfptd, and while I know how to chroot jail using vsftpd's config, I want to try it using sshd_config
. However, modifying the sshd_config
file as I am is preventing FTP connections for only the users I am trying to jail.
Verifying my SSH protocol version is higher than 5.0:
telnet <host> 22:
SSH-2.0-OpenSSH_5.3
Adding a user:
groupadd testgroup
useradd -d /home/testdir/testuser -g testgroup testuser
chown -R root:testgroup /home/testdir
chmod -R 775 /home/testdir
sshd_config file:
Subsystem sftp internal-sftp
Match group testgroup
ChrootDirectory /home/testdir/%u
ForceCommand internal-sftp
AllowTcpForwarding no
After restarted sshd and vsftpd:
service restart sshd
service restart vsftpd
My testuser
recieves the following error while attempting to FTP in using Filezilla:
Status: Connecting to <host>...
Response: fzSftp started
Command: open "testuser@<host>" 22
Command: Pass: ********
Error: Network error: Software caused connection abort
Error: Could not connect to server
If I create a new user on a different group, he can FTP in fine without this error. This leads me to conclude that my sshd_config
file is not set up correctly.