N
N
Nikolay Baranenko2018-06-13 14:28:03
CentOS
Nikolay Baranenko, 2018-06-13 14:28:03

What's wrong with setting sftp: Couldn't read packet: Connection reset by peer?

Hello.
Configured on CentOS sftp:
added group
groupadd sftp
created user
useradd -m sftp_user_1 -s /sbin/nologin -g sftp
set password
passwd sftp_user_1
changed owner
chown root /home/sftp_user_1
set rights
chmod 750 /home/sftp_user_1
changed owner
chown sftp_user_1:sftp /home/sftp_user_1
checked
id sftp_user_1

[[email protected] home]# id sftp_user_1
uid=1000(sftp_user_1) gid=1000(sftp) groups=1000(sftp)

edited the file
commented out
Subsystem sftp /usr/libexec/openssh/sftp-server
changed to
Subsystem sftp internal-sftp
at the end of the file added
Match Group sftp
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /home/%u
ForceCommand internal-sftp

restarted
systemctl restart sshd
trying to connect
[[email protected] home]# sftp s[email protected]
[email protected]'s password:
packet_write_wait: Connection to ::1 port 22: Broken pipe
Couldn't read packet: Connection reset by peer

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
N
Nikolay Baranenko, 2018-06-13
@drno-reg

when changing the owner, it was necessary to register the group:
chown root:sftp /home/sftp_user_1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question