<a href="http://blog.csdn.net/chenxingzhen001/article/details/7740357" target="_blank">http://blog.csdn.net/chenxingzhen001/article/details/7740357</a>
1.在本地机器上生成密码对
ssh-keygen -t rsa
查看一下ls
id_rsa id_rsa.pub known_hosts
2.将公钥拷到服务器端/root/.ssh下并安装
scp id_rsa.pub root@sg203:/root/.ssh
cat id_rsa.pub >> authorized_keys
chmod 600 authorized_keys
3.在服务器sg203上开启ssh服务的Pubkey认证功能,操作方法如下
vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
然后重启ssh服务 service sshd restart
本文转自flayber 51CTO博客,原文链接:http://blog.51cto.com/406647516/1921413,如需转载请自行联系原作者