I would like to create
sftp user account on Ubuntu server which has read/write access only to one specific folder. I would like this user to have rights to transfer files up and from my server via
sftp. My server is hosted on Digital Ocean.
I have followed this tutorial on Digital Ocean which seems to do exactly what I want but I got stuck at
Step 4 says that you try this command:
And result should be:
Error message This service allows sftp connections only. Connection to localhost closed.
Instead my result is:
packet_write_wait: Connection to 188.8.131.52 port 22: Broken pipe Connection closed
Next it instructs running this, which should obviously work:
The result should be:
SFTP prompt Connected to localhost. sftp>
but instead I get:
forge@BitCloud:~$ sftp misjah@localhost misjah@localhost's password: packet_write_wait: Connection to 127.0.0.1 port 22: Broken pipe Couldn't read packet: Connection reset by peer
I get the same message if I want to
sftp with this newly created user from outside:
prmbair:~ primozrome$ sftp email@example.com firstname.lastname@example.org's password: packet_write_wait: Connection to 184.108.40.206 port 22: Broken pipe Connection closed prmbair:~ primozrome$
What am I doing wrong?
Update from comments:
Seems like problem is in the
ChrootDirectory line. If I use
ChrootDirectory %h then sftp to users home directory works, but if I use
ChrootDirectory /home/user/uploads (to restrict only to one folder) then:
packet_write_wait: Connection to 127.0.0.1 port 22: Broken pipe. Couldn't read packet: Connection reset by peer.