OpenSSH : SFTP only + Chroot2025/08/11 |
|
Configure SFTP only + Chroot. |
|
| [1] | For example, Set [/home] as the Chroot directory. |
|
root@dlp:~#
vi /etc/ssh/sshd_config # line 117 : comment out and add a line like below # Subsystem sftp /usr/lib/openssh/sftp-serverSubsystem sftp internal-sftp
# add to last line
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /home
ForceCommand internal-sftp
systemctl restart ssh
|
| [2] | Try to access with a user and verify the settings. |
|
trixie@node01:~$ ssh trixie@dlp.srv.world
trixie@dlp.srv.world's password:
This service allows sftp connections only.
Connection to dlp.srv.world closed. # denied as settings
trixie@node01:~$ sftp trixie@dlp.srv.world trixie@dlp.srv.world's password: Connected to dlp.srv.world. sftp> |
| Sponsored Link |
|
|