Putty server refused our key的解决方法

在使用putty工具使用密钥远程登陆CentOS系统时,出现Putty server refused our key提示,解决办法:

1.查看是否关掉SELINUX。

相关命令:getenforce, setenforce

相关配置文件:/etc/selinux/config

2.查看sshd配置

相关配置文件:/etc/ssh/sshd_config

主要查看这4个参数:

PermitRootLogin yes (如果要用root身份远程登陆系统)
StrictModes no (如果StrictModes为yes必需保证存放公钥的文件夹的拥有与登陆
用户名是相同的.“StrictModes”设置ssh在接收登录请求之前是否检查用户家目录
和rhosts文件的权限和所有权)
PubkeyAuthentication yes (启用公钥认证机制)
AuthorizedKeysFile      .ssh/authorized_keys (设置私钥文件名,.ssh的目录权限必须是700或者600)

原文地址:https://www.cnblogs.com/xiaoniunwp/p/3879903.html