centos使用ssh-key免密登录
文章目录
centos ssh login 免密码登录
-
修改linux主机sshd配置
1vi /etc/ssh/sshd_config 2 RSAAuthentication yes 3 PubkeyAuthentication yes 4 AuthorizedKeysFile .ssh/authorized_keys 5/sbin/service sshd restart
-
生成密钥,包括 id_rsa私钥,id_rsa.pub公钥
1 ssh-keygen -t rsa
-
更改文件名
1 mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
-
拷贝id_rsa文件内容到任何一个linux客户端,remote.pem,使用ssh登录
1ssh -i remote.pem user@host