Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have configured sftp access for user using this guide: Linux shell to restrict sftp users to their home directories?

I have problem though.

I have taken all steps. I have chown'ed root:user the home folder and I set permissions to 755.

I can login normally using SFTP, however I can NOT transfer files, can NOT mkdir directories. If I change permissions to 777 it's ok do edit everything. However this is the thing I don't want. Additionally after exiting sftp and reconnecting then connection is reset by peer (due to setting 777).

Anyone had similar problem? What I am doing wrong?

share|improve this question

migrated from Apr 3 '12 at 16:43

This question came from our site for professional and enthusiast programmers.

I tested that, it return "Connection closed" (no peer message). Well, I found semi-solution, so have I asked here. But possibly this could be moved there. – Tomasz Durka Apr 3 '12 at 12:18
Are you logging in with "root" or "user"? – Hugo Apr 3 '12 at 17:27

In order to use the chroot restrict user to home dir scheme the top folder must be owned by root. You need to create folders under the users home folder owned by the user to allow upload. For example /home/user owned by root /home/user/uploads owned by user. Upload into the uploads folder not the users home folder..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.