Article

Limit SFTP User Access To Specific Directory

AOAnonymous One· Sep 1, 20221 min read
  • #Linux
  • #Ubuntu
  • #SFTP

Limit SFTP User Access To Specific Directory

Ubuntu guide to limit users of a sftp server to access specific directory like a ftp server hosted on windows.

Set configuration for /etc/ssh/sshd_config

Subsystem sftp internal-sftp -f AUTH -l VERBOSE
UsePAM yes
Match group sftp
  ChrootDirectory %h
  ForceCommand internal-sftp
  AllowTcpForwarding no

Create group for SFTP

  • groupadd sftp

Create user directly w/new SFTP group attached

sudo useradd -m <user-name> -g sftp -s /bin/false
sudo passwd <user-name>

Set permission for use with SSH/SFTP

chown root:root /ftpsusers/HomeFolder
chmod 755 /ftpusers/HomeFolder

Finally, restart the ssh service to see changes take effect

  • sudo systemctl restart sshd

References

https://askubuntu.com/questions/598870/limit-sftp-user-access-to-specified-directory

0 Comments

Sign in to join the conversation.

Search

Jump to a page, story or project