Created
November 19, 2012 16:50
-
-
Save fgbreel/4111804 to your computer and use it in GitHub Desktop.
SFTP with OpenSSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Subsystem sftp "internal-sftp -u 0002" | |
Match Group sftponly | |
ChrootDirectory %h | |
AllowTCPForwarding no | |
X11Forwarding no | |
ForceCommand internal-sftp -u 0002 |
Remove from /etc/ssh/sshd_config
any line containing sftp
Put the content above at the end of the file /etc/ssh/sshd_config
execute the commands below to create a group who will be matched on the rule of the snippet above, an user, and the correct directory permissions.
groupadd sftponly
useradd -s /bin/bash -G sftponly -m sftp-user
passwd sftp-user
chown root:root /home/sftp-user
mkdir /home/sftp-user/incoming && chown sftp-user /home/sftp-user/incoming
Cool thing, man! ๐
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice ๐