Skip to content

Instantly share code, notes, and snippets.

@nghuuphuoc
Last active December 27, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nghuuphuoc/7348102 to your computer and use it in GitHub Desktop.
Save nghuuphuoc/7348102 to your computer and use it in GitHub Desktop.
Setup chroot SFTP on Centos
# See http://www.thegeekstuff.com/2012/03/chroot-sftp-setup/
$ groupadd apl_devs
$ useradd -g apl_devs -d /var/www/sass -s /sbin/nologin apl_dev_sass
$ passwd apl_dev_sass
Changing password for user apl_dev_sass.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
# Verify
$ grep apl_dev_sass /etc/passwd
apl_dev_sass:x:500:500::/var/www/sass:/sbin/nologin
$ sudo nano /etc/ssh/sshd_config
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
$ chown -R apl_dev_sass:apl_devs /var/www/sass/path/to/particular/folder
$ service sshd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment