0

I am trying to setup a sftp account to a specific folder. I have created a group ftpaccess and user testuser with home directory as seen here:

sudo addgroup ftpaccess

sudo useradd -d /home/forge/mydomain.com/downloads -m testuser -g ftpaccess -s /bin/false

sudo passwd testuser

sudo chown root:root /home/forge/mydomain.com/downloads

sudo chmod 755 /home/forge/mydomain.com/downloads

Then I have created an transfers directory inside testuser home folder:

sudo mkdir /home/forge/mydomain.com/downloads/transfers

sudo chown testuser:ftpaccess /home/forge/mydomain.com/downloads/transfers

Then I have setup sshd_config like this (rules added to the end of file):

# SFTP account
Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
PasswordAuthentication yes

Now trying to sftp with this user sftp testuser@localhost but I get error:

packet_write_wait: Connection to 127.0.0.1 port 22: Broken pipe
Couldn't read packet: Connection reset by peer

What am I doing wrong?

  • did you set a password to testuser? So you should type 'sftp testuser:password@localhost' – Redbob Aug 30 '17 at 15:39
  • @Redbob sure I did with following command "sudo passwd testuser" – Primoz Rome Aug 30 '17 at 15:44
  • @PrimozRome did you fix your problem? I have the same situation – inye Apr 3 '18 at 21:57
0

Please try moving Subsystem sftp internal-sftp line from your existing block to # override default of no subsystems in sshd_config

It worked for me.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.