兩台Linux主機無密碼登入通過ssh方式
1、首先克隆一台虛拟機
<a href="https://s2.51cto.com/wyfs02/M02/A7/30/wKioL1ni9kagAH4dAAC_6XPJI0w524.png-wh_500x0-wm_3-wmp_4-s_2116612124.png" target="_blank"></a>
<a href="https://s4.51cto.com/wyfs02/M00/08/7C/wKiom1ni-PyRqTHLAABVI7tDjno126.png-wh_500x0-wm_3-wmp_4-s_3208966327.png" target="_blank"></a>
<a href="https://s4.51cto.com/wyfs02/M00/A7/30/wKioL1ni9kbzvHq6AABYGBwRRQw750.png-wh_500x0-wm_3-wmp_4-s_3381046013.png" target="_blank"></a>
<a href="https://s4.51cto.com/wyfs02/M01/08/7C/wKiom1ni-P2BCLC6AABFH_DaUxI669.png-wh_500x0-wm_3-wmp_4-s_264404909.png" target="_blank"></a>
2、克隆後記得更改IP位址
3、兩台機192.168.209.128、192.168.209.129
在192.168.209.128上ssh到192.168.209.129上,無密碼登入
4、ssh-keygen,一直回車即可
<a href="https://s4.51cto.com/wyfs02/M01/A7/30/wKioL1ni9kfiD7uXAABtHroHbvE750.png-wh_500x0-wm_3-wmp_4-s_2236247154.png" target="_blank"></a>
5、将128虛拟機上的公鑰拷貝到129虛拟機的配置檔案中
cat /root/.ssh/id_rsa.pub中的内容拷貝到129虛拟機上的/root/.ssh/authorized_keys中
6、ssh 192.168.209.129 試試無密碼登入
<a href="https://s4.51cto.com/wyfs02/M02/08/7C/wKiom1ni-P2RZgfmAABJR_o66zE872.png-wh_500x0-wm_3-wmp_4-s_217528126.png" target="_blank"></a>
大坑:檢查下權限,若是沒有配置,則還是要輸入密碼
[nginx@centos7-2 ~]$ chmod 700 .ssh
[nginx@centos7-2 ~]$ chmod 600 .ssh/authorized_keys
本文轉自 jiekegz 51CTO部落格,原文連結:http://blog.51cto.com/jacksoner/1972476