I am trying to upload files to a server I have been configuring using sftp. Therefore I am using the internal-sftp server of openSSH Server.
I tried to add following code to /etc/ssh/sshd_config
Match User web
ChrootDirectory /var/www
ForceCommand internal-sftp
But I always get the error Connection reset by peer
. If I leave the code out, it works – but I am of course in the wrong directory (/home/web
). What's the problem here and what can I do to achieve what I described?
Answer
I answered this on Unix Stackexchange. This was answered many times, but I can't find it now. The answer is RTFM.
Short story long: From man sshd_config
you can get this line:
ChrootDirectory
Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory.
Which provides explanation for your error message. Fixing the ACLs on the path will solve your issue.
There is also error in your server log (good place to start investigating such issues) describing this problem.
No comments:
Post a Comment