Below are the steps I performed:

I created group sftponly.

Added one user named sftpusers to that group.

Added Subsystem sftp internal-sftp to file /etc/ssh/sshd_config

Added this line to the file /etc/ssh/sshd_config:

Match group sftponly 
      ChrootDirectory /home/sftpusers 
      X11Forwarding no 
      AllowTcpForwarding no 
  ForceCommand internal-sftp 

But the user is not restricted to the path /home/sftpusers. It is able to access directories of other users in /home. Is it possible to restrict user to a particular directory and not able to access other user directories in /home or any other path in unix.


I have a very similar configuration to yours.

ssh_config(5) says:

note that key- words are case-insensitive and arguments are case-sensitive

So the first line in your config needs to have an upper case G, like so:

Match Group sftponly

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.