Can not create SFTP user Linode Debian 7

i have a linode and i access via ssh throw terminal. I need to create an sftp user which his default directory (and the only he can acces) is /var/www/xxxxxx.com/public_html/directory

Now, i did it, but when i try to connect i get broken pipe or connection rejected by peer

what i did is this:

$ adduser --home /var/www/xxxxxx.com/public_html/directory/ username
$ chown username:username /var/www/xxxxxx.com/public_html/directory/
$ chmod 755 /var/www/xxxxxx.com/public_html/directory/
$ nano /etc/ssh/sshd_config

In /etc/ssh/sshd_config add following lines

Match User username
   ChrootDirectory /var/www/xxxxxx.com/public_html/directory/
   AllowTCPForwarding no
   X11Forwarding no
   ForceCommand internal-sftp

What im doing wrong?

1 Reply

If you're jailing the user to '/var/www/xxxxxx.com/public_html/directory/', then that directory needs to be owned by root, not the user. Anything in the directory can be owned by the user however.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct