前提:
1.客户端生成了id_rsa.pub和id_rsa
2.服务端在.ssh/authorized_keys也加入了客户端的id_res.pub
3./etc/ssh/sshd_config开启了:
- RSAAuthentication yes
- PubkeyAuthentication yes
- AuthorizedKeysFile .ssh/authorized_keys
但在客户端执行ssh依然报错:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
最后在网上折腾了半天才发现原来是SELinux的问题,只要关闭SELinux在重新启动就可以了:
暂时关闭(重启后恢复):
setenforce 0