I have configured sftp access for user using this guide: https://stackoverflow.com/questions/1526919/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?

migrated from stackoverflow.com 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"? – WhyNotHugo 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..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy