1. 生成证书
ssh-keygen -t rsa
生成两个文件,密钥:id_rsa,公钥:id_rsa.pub
拷贝公钥到authorized_keys: cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
2. 修改sshd_config
PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启ssh服务 service sshd restart
3. 拷贝私钥id_rsa到客户机,在客户机使用id_rsa连接到目标机
ssh -i id_rsa root@192.151.103.124