Chroot environment setup

Revision as of 23:13, 6 December 2018 by Heiko (talk | contribs)
Jump to navigation Jump to search

Setting up a chroot-environment:

Add this to /etc/ssh/sshd_config:

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp

# Heiko was here and did
Match Group filetransfer
   ChrootDirectory %h
   X11Forwarding no
   AllowTcpForwarding no
   ForceCommand internal-sftp

Restart sshd

service ssh restart

Add a new group

addgroup --system filetransfer

For each chrooted user:

usermod -G filetransfer username
chown root:root /home/username
chmod 755 /home/username
cd /home/username
mkdir docs public_html
chown username:filetransfer *