GuidePedia

0

Configure SFTP only + Chroot.
Some users applied this settings can access only with SFTP and access to the permitted directories.
[1] For example, Set /home as the Chroot directory.
# create for SFTP only group

root@dlp:~#
groupadd sftp_users

# apply to a user "ubuntu" for SFTP only

root@dlp:~#
usermod -G sftp_users ubuntu

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

#
Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
# add at the last

Match Group sftp_users
  X11Forwarding no
  AllowTcpForwarding no
  ChrootDirectory /home
  ForceCommand internal-sftp
root@dlp:~#
initctl restart ssh

ssh start/running, process 2290
[2] Try to access with a user and make sure the settings.
root@rx-7:~#
ssh ubuntu@10.0.0.30

cent@10.0.0.30's password:
Could not chdir to home directory /home/ubuntu: No such file or directory
This service allows sftp connections only.
Connection to 10.0.0.30 closed.
# denyed normally
root@rx-7:~#
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    5 1000     1000         4096 Apr 18 12:58 trusty
drwxr-xr-x    3 1001     1001         4096 Apr 18 13:16 ubuntu
sftp>
pwd

Remote working directory: /
sftp>
exit

Post a Comment

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks

Visitors

Cloud Power For You

Website Hosting At Low Price

Contatc

Empire Views
 
Top