Setup SFTP server on debian 8 (chroot)
In this post, I will introduce how to setup an sftp server by using ssh
su -
groupadd sftp_users
usermod -G sftp_users my_usernameThen:
$ emacs /etc/ssh/sshd_config
# Search the line below and replace it
Subsystem sftp /usr/lib/openssh/sftp-server
# by this one
Subsystem sftp internal-sftp
# Now each time that a user connects from the sftp group,
# we are gonna apply theses rules:
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /home
ForceCommand internal-sftp Finally:
systemctl restart sshStackOverflow - SFTP difference between internal sftp and sftp server
Edit: If you need to remove a user from a group:
gpasswd -d user groupor debian includes a tool:
deluser user group