Skip to content

Instantly share code, notes, and snippets.

@nadirs
Created July 28, 2017 13:29
Show Gist options
  • Save nadirs/0d66a1af1350e7ff6078212d9cdc5969 to your computer and use it in GitHub Desktop.
Save nadirs/0d66a1af1350e7ff6078212d9cdc5969 to your computer and use it in GitHub Desktop.
useradd $1
mkdir /home/$1/www
chown root /home/$1
echo "/some/external/dir /home/$1/www none rw,bind" >> /etc/fstab
mount -a
echo "
Match User $1
ChrootDirectory /home/$1
ForceCommand internal-sftp
" >> /etc/sshd_config
service sshd reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment