I have problem when I want to config my SSH server, I have username root and guest.

I want root still can access SSH and for guest users , only can transfer file (copy and paste) some directory.

in my problem is when I am login using guest users with SCP,SFTP,SSH it's possible to view my Filesystem in server,i think it's not good for security.

I want to make secure if Guest login using ssh,sftp,scp, only some folder I am configuration is showed, example (/var/www/site)

Any suggestion How I can make like that ?

1 Answer 1

  1. Create a new group, e.g. 'scponly'.
  2. Create the target user accounts and set their home directory to the intended path, e.g. /var/www/site. Add these user accounts to group scponly.
  3. Add this to /etc/ssh/sshd_config:

    Match Group scponly
      ChrootDirectory %h
      ForceCommand internal-sftp
      AllowTcpForwarding no
      AllowAgentForwarding no
      X11Forwarding no

Now the users in group scponly will not be able to login to the system but only use SFTP/SCP. And they will be restricted to their home directory which will be shown as /.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.