配置雙機SSH信任

主機A:172.28.9.208(oracle/oracle123)

主機B:172.28.6.190 (oracle/oracle)

需要配置主機A無密碼登錄主機A,主機B

先確保所有主機的防火牆處於關閉狀態。

在主機A上執行如下:

1. $cd ~/.ssh

2. $ssh-keygen -t rsa  --------------------然後一直按回車鍵,就會按照默認的選項將生成的密鑰保存在.ssh/id_rsa文件中。

Generating public/private rsa key pair.

Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /export/home/oracle/.ssh/id_rsa.

Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

a5:5c:80:81:6c:2d:8c:0e:89:11:0d:c8:9a:13:b9:bc oracle@idc-sparc

 

3. $cp id_rsa.pub authorized_keys 這步完成後,正常情況下就可以無密碼登錄本機了,即ssh localhost,無需輸入密碼。

4. $scp authorized_keys [email protected]:/home/oracle/.ssh   ------把剛剛產生的authorized_keys文件拷一份到主機B上. 

進入主機B的.ssh目錄,改變authorized_keys文件的許可權限 

$chmod 600 authorized_keys      

     


發佈了40 篇原創文章 · 獲贊 52 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章