xshell无法连接提示ssh服务器拒绝密码

解决步骤

1.打开目标服务器的/etc/ssh/sshd_config文件

你配置文件中 PermitRootLogin prohibit-password 这一行意味着禁止 root 用户使用密码登录,只能使用密钥登录。 你需要删除这一行或将其改为 PermitRootLogin yes 才能允许 root 使用密码登录。 这是最可能的原因。

操作步骤总结:

修改 /etc/ssh/sshd_config: 将 PermitRootLogin prohibit-password 改为 PermitRootLogin yes,并取消 PasswordAuthentication yes 的注释 (确保其值为 yes)。
重启 SSH 服务: sudo systemctl restart sshd
再次使用 Xshell 连接。

posted @ 2025-06-18 14:04  Haloiwuhan  阅读(414)  评论(0)    收藏  举报