客户端
(1)生成公钥
ssh-keygen
(2)将公钥复制到服务器的/root/.ssh/目录
scp ~/.ssh/id_rsa.pub root@192.168.1.26:/root/.ssh/id_rsa.pub
服务器
(1)打开登录验证
vi /etc/ssh/sshd_config
删掉这两行的注释
RSAAuthentication yes
PubkeyAuthentication yes
(2)导入公钥
touch /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
(3)修改权限
chmod 700 /root/.ssh/
chmod 600 /root/.ssh/authorized_keys