Skip to content

Instantly share code, notes, and snippets.

@mamedshahmaliyev
Last active October 29, 2019 19:49
Show Gist options
  • Save mamedshahmaliyev/76b09a33b5b04385b776e9bbee79922b to your computer and use it in GitHub Desktop.
Save mamedshahmaliyev/76b09a33b5b04385b776e9bbee79922b to your computer and use it in GitHub Desktop.
How to create chroot user
useradd sftp_user
passwd sftp_user
#################################################################################################################
# VERY IMPORTANT: all the elements in /path/to/chroot_folder must be owned by root with at most 755 permissions #
#################################################################################################################
echo '''
Match User sftp_user
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /path/to/chroot_folder
ForceCommand internal-sftp -u 002 # mask for 775
''' >> /etc/ssh/sshd_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment