I try to configure SFTP on Centos 7, on my first server it works perfectly, but on my second server when I try to connect me with :
sftp USERNAME@serveripaddress
I have this error :
Could not read packet: Connection reset by peer
I use this method :
adduser USERNAME
passwd USERNAME
groupadd sftp_only
usermod -aG sftp_only USERNAME
Configure SSH chroot :
vi /etc/ssh/sshd_config
Add a comment :
#Subsystem Sftp /usr/libexec/openssh/sftp-server
Add the line after :
Subsystem sftp internal-sftp
Add at the end of the file :
Group sftp_only Match
ChrootDirectory /var/www
ForceCommand internal-sftp
X11Forwarding No
AllowTcpForwarding No
Restart SSH :
service sshd restart
I have the same iptables rules on my 2 servers and I try with iptables disabled.
Maybe I need to install an FTP server like VSFTPD ?
Thank you to help me because I'm completely blocked since several hours.