歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> linux雙機ssh互信方法總結

linux雙機ssh互信方法總結

日期:2017/3/3 11:45:03   编辑:Linux技術

方法一:

1. ssh-keygen -t rsa -b 1024 -t表示類型 -b表示密鑰大小(當然也可以直接使用ssh-keygen生成) 2. test@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host (這樣傳輸的秘鑰認證也是test用戶的,請根據自己需求,來做相應的操作;默認保存在了remote-host的相應用戶的.ssh/authorized_keys中)3. ssh remote-host (還是注意使用當然用戶) 另一台服務器重復此操作

方法二:

ssh-keygen -t rsa -b 1024 創建秘鑰過程相同

chmod -R 700 ~/.ssh;將公鑰復制到另一台機器上,寫入authorized_keys中。

scp 公鑰 root@另一台IP:root/

cat 公鑰>>/root/.ssh/authorized_keys;chmod 600 /root/.ssh/authorized_keys(在remote-host中操作)另一台服務器重復此操作

Copyright © Linux教程網 All Rights Reserved