建立SSH信任
將A主機做為客戶端(發起SSH請求 ip:192.168.200.170)
將B主機作為服務器端(接收ssh請求 ip:192.168.200.149)
以上以主動發起SSH登錄請求的主機和接收請求的主機進行分類
<1>A主機生成公,私鑰證書
[root@buddytj-10 .ssh]# ssh-keygen -t rsa #rsa算法的證書
Generating public/private rsa key pair. (以下一路回車)
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y (因為我的證書已存在,覆蓋即可)
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa. (私鑰)
Your public key has been saved in /root/.ssh/id_rsa.pub. (公鑰)
The key fingerprint is:
c1:26:cc:88:2b:05:dd:c3:6b:1e:78:5d:da:9c:da:8a
證書就生成了 id_rsa (私鑰)|& id_rsa.pub (公鑰)
<2>將A主機生成的公鑰傳遞給B主機
[root@xyh .ssh]#scp id_rsa.pub 192.168.200.149:/root/.ssh/
在B主機上將A的公鑰更名為
[root@xyh .ssh]#mv id_rsa.pub authorized_keys
<3>至此從A主機遠程SSH B主機的工作即告完成
呵呵,超簡單的!