Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Inquisitive's avatar

FATAL ERROR: Connection reset by peer, could not connect to user

I was connecting successfully on sftp few hours back, but once I make some changes to the permission of the directory, it is working no more.

Let me show you first how I set up the sftp:

- sudo apt install openssh-server
- sudo addgroup sftpgroup
- sudo nano /etc/ssh/sshd_config 

//commented below line
# Subsystem sftp /usr/lib/openssh/sftp-server

//added following lines at the bottom
==========================
Subsystem sftp internal-sftp
Match group sftpgroup
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
========================

- sudo service ssh restart
- sudo adduser sftpuser --ingroup sftpgroup --shell /usr/sbin/nologin
- sudo chown root:root /home/sftpuser
- sudo mkdir /home/sftpuser/taaupload
- sudo chown sftpuser:sftpgroup /home/sftpuser/taaupload

With this sftpuser was allowed to upload files to /taaupload directory, now I wanted to give permission to /home/sftpuser

and I messed it somewhere.

results of some command:

groups sftpuser returns

sftpuser : sftpgroup

ls -ld /home/sftpuser/ return

drwxrwxr-x 4 root sftpgroup 4096 Aug 12 09:10 /home/sftpuser/

and tried to connect again to sftp using filezilla by checking the auth log as tail -f /var/log/auth.log

And, here is the screenshot.

https://ibb.co/Yc7fPXx

I have also tried to connect using sftp via ssh as:

sftp sftpuser@localhost

and when I enter password, it says,

client_loop: send disconnect: Broken pipe
Connection closed
0 likes
0 replies

Please or to participate in this conversation.