这篇文章(http://wenku.baidu.com/view/209408d258f5f61fb7366696.html?re=view)写得不错,有几点要注意:html
若服务器被重装过须要使用:缓存
ssh-keygen -f "/home/xxx/.ssh/known_hosts" -R 192.168.0.218服务器
命令把原来的缓存清理掉ssh
使用htm
cat id_rsa.pub >> ~/.ssh/authorized_keys rsa
能够将pub文件添加道keys文件结尾
ssh-key
cat hosts
id_rsa.pub >> 文件
~view
/.ssh/authorized_keys