CentOS SFTP配置中常见错误及解决方法如下:
sudo systemctl status sshd,未启动则执行sudo systemctl start sshd并设置开机自启sudo systemctl enable sshd。sudo firewall-cmd --permanent --add-service=ssh,然后sudo firewall-cmd --reload。/etc/ssh/sshd_config中Subsystem sftp路径是否正确(通常为internal-sftp或/usr/libexec/openssh/sftp-server),并确保ChrootDirectory等指令配置无误,修改后重启服务。ChrootDirectory)需为root:root且权限为755,用户主目录权限通常为755,上传目录可设为775,确保用户对目标目录有写入权限。sudo setenforce 0,若问题解决则调整策略,如设置SELINUX=permissive或通过semanage修改文件上下文。sftpusers),公钥认证需将公钥放入~/.ssh/authorized_keys并设置权限为600。ping和telnet),确认SSH服务监听端口正确,可在配置中添加TCPKeepAlive yes等参数优化连接。