1.在客户端生成公钥私钥对
[root@localhost ~]# ssh-keygen -t rsa
一路默认回车,系统在/root/.ssh下生成id_rsa、id_rsa.pub
2.查看系统生成的公钥私钥对
[root@localhost ~]# ls /root/.ssh id_rsa id_rsa.pub
3.配置互信,将当前id_rsa.pub 的值存入互信ip的authorized_keys文件中;
[root@localhost .ssh]# cat id_rsa.pub
[root@localhost ~]# vi authorized_keys
4.现在可以测试连接其他服务器是否不需要密码登录,可以看到确实成功了。可来回切换
[root@localhost .ssh]# ssh 192.168.10.102
Last login: Wed Mar 11 08:58:44 2020 from 192.168.10.128
[root@localhost ~]# ssh 192.168.10.128
Last login: Tue Mar 10 17:00:39 2020 from 192.168.10.102
[root@localhost ~]# ssh 192.168.10.102
Last login: Wed Mar 11 09:01:35 2020 from 192.168.10.128
[root@localhost ~]# ssh 192.168.10.128
Last login: Tue Mar 10 17:03:28 2020 from 192.168.10.102
[root@localhost ~]#