转载自:http://www.2cto.com/os/201206/137286.html
-
ssh使用公钥授权不通过的问题解决前提:1.客户端生成了id_rsa.pub和id_rsa2.服务端在.ssh/authorized_keys也加入了客户端的id_res.pub3./etc/ssh/sshd_config开启了:Shell代码 www.2cto.comRSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keys但在客户端执行ssh依然报错:Shell代码Permission denied (publickey,gssapi-keyex,gssapi-with-mic).在这个页面不小心看到了原因:
http://serverfault.com/questions/230771/ssh-configuration-publickeys-permission-denied-publickey-password-error又是TM的SE Linux惹的祸,关闭SELinux解决问题:暂时关闭(重启后恢复):Shell代码 www.2cto.comsetenforce 0永久关闭(需要重启):Shell代码vi /etc/selinux/configSELINUX=disabled另:ssh可同时支持publickey和password两种授权方式,publickey默认不开启,需要配置为yes。如果客户端不存在.ssh/id_rsa,则使用password授权;存在则使用publickey授权;如果publickey授权失败,依然会继续使用password授权。作者 flysnowxf