SLES 11 SP4
Sponsored Link

SFTP only + Chroot2015/11/28

 
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.
# create a group for SFTP

dlp:~ #
groupadd sftp_users

# for example, apply to a user "suse" for SFTP only

dlp:~ #
usermod -G sftp_users suse

dlp:~ #
vi /etc/ssh/sshd_config
# line 135: comment out and add a line like below

#
Subsystem sftp /usr/lib64/ssh/sftp-server
Subsystem sftp internal-sftp
# add follows to the end

Match Group sftp_users
  X11Forwarding no
  AllowTcpForwarding no
  ChrootDirectory /home
  ForceCommand internal-sftp
dlp:~ #
/etc/init.d/sshd restart

[2] Try to access with a user to verify settings.
suse@rx7:~>
ssh suse@10.0.0.30

password:
This service allows sftp connections only.
Connection to 10.0.0.30 closed.    
# denied normally
suse@rx7:~>
sftp suse@10.0.0.30

Connecting to 10.0.0.30...
password:
sftp>
ls -l

drwxr-xr-x    7 suse     100           169 Nov 21 22:35 suse
drwxr-xr-x    7 cent     100           169 Nov 21 22:35 cent
sftp>
pwd

Remote working directory: /
sftp>
exit

Matched Content