<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,如需轉載請自行聯系原作者