Skip to content

Instantly share code, notes, and snippets.

Created July 12, 2017 23:37
Show Gist options
  • Save anonymous/3456e2b3f4e51208fd5b999f964314c6 to your computer and use it in GitHub Desktop.
Save anonymous/3456e2b3f4e51208fd5b999f964314c6 to your computer and use it in GitHub Desktop.
sudo addgroup sftp

Добавляем в конец /etc/ssh/sshd_config

Subsystem sftp internal-sftp
Match Group sftp
    ChrootDirectory %h
    AllowTCPForwarding no
    ForceCommand internal-sftp

И комментируем там же

#Subsystem sftp /usr/lib/openssh/sftp-server
sudo /etc/init.d/ssh restart

Если поменять владельца у домашней папки, то пользователь по SFTP не сможет выйти из неё.

chown root:root "/home/$USERNAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment