OpenSSH : SFTP only + Chroot2019/04/22 |
Configure SFTP only + Chroot.
Some users who are applied this settings can access only with SFTP and access to the permitted directories. |
|
[1] | For example, Set /home as the Chroot directory. |
root@dlp:~#
vi /etc/ssh/sshd_config # line 115: comment out and add a line like below # Subsystem sftp /usr/lib/openssh/sftp-serverSubsystem sftp internal-sftp
# add to the end
Match Group sftp_users
X11Forwarding no AllowTcpForwarding no ChrootDirectory /home ForceCommand internal-sftp systemctl restart ssh |
[2] | Try to access with a user and make sure the settings. |
ubuntu@www:~$
ubuntu@www:~$ ssh ubuntu@10.0.0.30 ubuntu@10.0.0.30's password: This service allows sftp connections only. Connection to 10.0.0.30 closed. # denied normally
sftp ubuntu@10.0.0.30 Connecting to 10.0.0.30... ubuntu@10.0.0.30's password: sftp> ls -l drwxr-xr-x 3 1001 1001 4096 Apr 21 03:11 ubuntu drwxr-xr-x 4 1000 1000 4096 Apr 21 12:24 discosftp> pwd Remote working directory: / sftp> exit |
Sponsored Link |