linux雙機ssh互信方法總結

方法一:

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 (還是注意使用當然用戶)

          另一臺服務器重複此操作


方法二:

  1.     ssh-keygen -t rsa -b 1024 創建祕鑰過程相同

  2.     chmod -R 700 ~/.ssh;將公鑰複製到另一臺機器上,寫入authorized_keys中。

  3.      scp 公鑰 root@另一臺IP:root/

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章