I've configured SFTP
on my virtual machine, because I wanted to test how can I use symlink
in order to access files outside from user home directory.
I've created user:
test:x:1003:1001::/var/www/test/public:/bin/false
Ownership and premissions:
drwxr-xr-x root root test
drwxr-xr-x test sftpusers public
Here is my sshd_config
:
Subsystem sftp internal-sftp
#UsePAM no
Match group sftpusers
ChrootDirectory /var/www/%u
AuthorizedKeysFile /var/www/%u/.ssh/authorized_keys
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
After that I had to login into my SFTP account and from there I did:
sftp> symlink / /public/root
I think most of the servers which use SFTP
are configured in a similar way.
So, what can be done in order to prevent symlink attack?