Can not create SFTP user Debian 7

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.


I solved it. The problem was because I did this:

$ chown user:user /var/www/xxxxxx.com/public_html/directory/

What I had to do is this:

$chown root:root /var/www/xxxxxx.com/public_html/directory/

Then, inside "directory" I made a directory for the user with 777 permission (is not the better way but it works).

The "rejected by peer" error is because /directory must have 755 permission.