配置節點間的SSH信任關係

dbahaoyuan發表於2014-11-21
配置節點間的SSH信任關係

  (1)在節點1上

  oracle@node1:~ > pwd

  /home/oracle

  oracle@node1:~ > mkdir .ssh

  oracle@node1:~ > chmod 700 .ssh #這一步很重要,而且必須是700許可權,否則失敗

  oracle@node1:~ > ssh-keygen –t rsa

  oracle@node1:~ > ssh-keygen –t dsa

  oracle@node1:~ > cd .ssh ; ls

  id_dsa id_dsa.pub id_rsa id_rsa.pub

  (2)在節點2上

  oracle@node2:~ > pwd

  /home/oracle

  oracle@node2:~ > mkdir .ssh

  oracle@node2:~ > chmod 700 .ssh #這一步很重要,而且必須是700許可權,否則失敗

  oracle@node2:~ > ssh-keygen –t rsa

  oracle@node2:~ > ssh-keygen –t dsa

  oracle@node2:~ > cd .ssh ; ls

  id_dsa id_dsa.pub id_rsa id_rsa.pub

  (3)建立信任關係

  oracle@node1:~/.ssh > cat id_rsa.pub >> authorized_keys

  oracle@node1:~/.ssh > cat id_dsa.pub >> authorized_keys

  oracle@node1:~/.ssh > ssh node2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys

  oracle@node1:~/.ssh > ssh node2 cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys

  oracle@node1:~/.ssh > scp authorized_keys node2:/home/oracle/.ssh/

  (4)測試信任關係

  oracle@node1:~ > ssh node2 date

  oracle@node2:~ > ssh node1 date

  均不用輸入密碼,則信任關係建立完畢!

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

相關文章