OpenSSH : SFTP only + Chroot2019/01/15 |
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. |
dlp:~ #
vi /etc/ssh/sshd_config # line 118: uncomment and add # Subsystem sftp /usr/lib/ssh/sftp-serverSubsystem sftp internal-sftp
# add to the end
Match Group sftp_users
X11Forwarding no AllowTcpForwarding no ChrootDirectory /home ForceCommand internal-sftp systemctl restart sshd |
[2] | Verify with the target user to access by SSH or SFTP. |
suse@rx7:~>
suse@rx7:~> ssh suse@10.0.0.30 password: This service allows sftp connections only. Connection to 10.0.0.30 closed. # denied normally
sftp suse@10.0.0.30 Connecting to 10.0.0.30... password: sftp> ls -l drwxr-xr-x 7 suse 100 169 Jan 12 22:35 suse drwxr-xr-x 7 suse 100 169 Jan 12 22:35 centsftp> pwd Remote working directory: / sftp> exit |
Sponsored Link |