问题原文
原帖链接 · Olaf · CC BY-SA 3.0
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.
社区高分解答
原帖链接 · Sérgio · CC BY-SA 4.0
cat /var/log/auth.log
May 10 17:08:32 machine sshd[31902]: fatal: bad ownership or modes for chroot directory component "/var/www/html/nextcloud/"
that was my problem
After we can follow this one bad ownership or modes for chroot directory component
BTW I end up using bind solution Need help - limit access to sftp user to other users home->subfolder
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
