sftp Broken pipe Couldn't read packet: Connection reset by peer
Matthew Martinez
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/ -m testuser -g ftpaccess -s /bin/false
sudo passwd testuser
sudo chown root:root /home/forge/
sudo chmod 755 /home/forge/Then I have created an transfers directory inside testuser home folder:
sudo mkdir /home/forge/
sudo chown testuser:ftpaccess /home/forge/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 yesNow 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 peerWhat am I doing wrong?
41 Answer
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.