兩臺Linux伺服器之間配置互信

kakaxi9521發表於2016-12-16
最近配了個備份,備份在伺服器A上,需要將備份的資料透過scp傳輸到伺服器B上進行保留,所以涉及到配置A到B的信任關係。
1. 在A伺服器上
[oracle@A yebiao]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
f2:0f:64:1c:0d:20:db:9b:9d:45:0a:23:b9:97:f3:83 伺服器
The key's randomart image is:
+--[ RSA 2048]----+
|    o.+.. .      |
|    .= o =       |
|    ....o o      |
|    . += +       |
|     .++S        |
|      E=o        |
|        o.       |
|         o       |
|          .      |
+-----------------+

2. 將生成的id_rsa.pub檔案複製到B伺服器的.ssh目錄下。
scp /home/oracle/.ssh/id_rsa.pub 10.18.1.119:/home/backup/.ssh/a.pub

3. 將a.pub的內容加入到authorized_keys檔案裡。
cat a.pub >> authorized_keys

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21374452/viewspace-2130760/,如需轉載,請註明出處,否則將追究法律責任。

相關文章