I did install sftp on CentOS and did add new group:
groupadd sftp
did create new user:
useradd -m sftp_user_1 -s /sbin/nologin -g sftp
did create password:
passwd sftp_user_1
did change owner:
chown root /home/sftp_user_1
did change rights:
chmod 750 /home/sftp_user_1
did change owner:
chown sftp_user_1:sftp /home/sftp_user_1
did check user and group:
id sftp_user_1
[root@centos-24 home]# id sftp_user_1
uid=1000(sftp_user_1) gid=1000(sftp) groups=1000(sftp)
did make changes in file /etc/ssh/sshd_config
Subsystem sftp /usr/libexec/openssh/sftp-server
did change to
Subsystem sftp internal-sftp
did add in end of file
Match Group sftp
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /home/%u
ForceCommand internal-sftp
did restart service
systemctl restart sshd
did try to connect to sftp server and returned error:
[root@centos-24 home]# sftp sftp_user_1@localhost
sftp_user_1@localhost's password:
packet_write_wait: Connection to ::1 port 22: Broken pipe
Couldn't read packet: Connection reset by peer
How solve this problem?
/home/sftp_user_1
tosftp_user_1
only two steps after you changed it toroot
. Why did you set it toroot
in the first place? If you're following a set of instructions you found somewhere, please include that in your question.