I have a configuration where specific users can log-in only in sftp and not ssh.
Also the users are jailed in specific directories.
Lets say the user name is stefanos and his rooted directory is /vhosts/wild.domain.com/
The directory is mounted with mount -o bind /var/www/websites/site1/ /vhosts/wild.domain.com/
The sshd_config is:
Match user stefanos
ChrootDirectory /vhosts/wild.domain.com/
ForceCommand internal-sftp
The log is:
Jun 23 15:42:52 hostname sshd[32447]: Accepted password for stefanos from 11.22.33.44 port 64759 ssh2
Jun 23 15:42:52 hostname sshd[32447]: pam_unix(sshd:session): session opened for user stefanos by (uid=0)
Jun 23 15:42:52 hostname sshd[32572]: subsystem request for sftp
Jun 23 15:43:07 hostname sshd[32447]: pam_unix(sshd:session): session closed for user stefanos
The problem is (thrown by WinSCP):
Cannot get real path for '/var/www/websites/site1'.
No such file or directory.
Error code: 2
Error message from server: No such file
Request code: 16
The strange thing is that when I click OK to the error message, it then logins correctly with all directories in their place.. What am I missing here ??