systemctl status sshd
(Linux)netstat -tuln | grep 22
iptables -L
或 firewall-cmd --list-all
tail -f /var/log/auth.log
或 /var/log/secure
/etc/ssh/sshd_config
配置:
Subsystem sftp /usr/lib/openssh/sftp-server
AllowUsers your_username
PasswordAuthentication yes
PubkeyAuthentication yes
systemctl restart sshd
telnet server_ip 22
或 nc -zv server_ip 22
错误1:Permission denied (publickey,password) - 解决方案:检查密码/密钥是否正确,确认服务器允许密码或密钥认证
错误2:Connection refused - 解决方案:检查SSH服务是否运行,端口是否正确,防火墙设置
错误3:Host key verification failed
- 解决方案:删除客户端~/.ssh/known_hosts
中对应条目重新连接
错误4:No supported authentication methods available - 解决方案:检查服务器认证方式配置,确保客户端支持
使用详细模式连接获取更多信息:
sftp -v user@host
检查磁盘空间(服务器端):
df -h
检查用户主目录权限:
ls -ld /home/username
尝试使用其他SFTP客户端(如FileZilla)测试
如果以上步骤仍无法解决问题,请提供具体的错误信息和环境配置,我可以提供更有针对性的解决方案。