Ford's Garage

Small garage of one Ford in the big internet


sftp-only user


So we want to create a sftp-only user with rw-access to certain folder, which located in home directory of another user

1. Create a file in /etc/ssh/sshd_config.d/ and put next text to it
Match User ftp1
    AllowTcpForwarding no
    X11Forwarding no
    PermitTunnel no
    AcceptEnv LANG LC_*
    ForceCommand internal-sftp
2. Put next string to the end of file /etc/fstab
/home/admin/web/site.com/public_html/images /home/ftp1/images none defaults,bind 0 0
3. Set the rw-rights

setfacl -R -m "u:ftp1:rwx" /home/admin/web/metbiz.ru/public_html/images
4. Mount a folder

mount --bind /home/admin/web/site.com/public_html/images /home/ftp1/images

This must be enough. You got your limited user. Test it.