rac中ssh信任设置代码示例及scp命令用法

以oracle用户身份执行,在所有节点上做如下配置以生成SSH密钥.

$ mkdir ~/.ssh
$ chmod 755 ~/.ssh
$ /usr/bin/ssh-keygen -t rsa
$ /usr/bin/ssh-keygen -t dsa
$ touch ~/.ssh/authorized_keys

[oracle@rac1.localdomain .ssh]$ ssh rac1.localdomain cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
  oracle@rac1.localdomain’s password:
  [oracle@rac1.localdomain .ssh]$ ssh rac1.localdomain cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys
  [oracle@rac1.localdomain .ssh$ ssh rac2.localdomain cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
  oracle@rac2.localdomain’s password:
  [oracle@rac1.localdomain .ssh$ ssh rac2.localdomain cat /home/oracle/.ssh/id_dsa.pub >>authorized_keys
  oracle@rac2.localdomain’s password:

  7. Use scp to copy the authorized file to other nodes in ~/.ssh
  [oracle@rac1.localdomain .ssh]scp authorized_keys rac2.localdomain:/home/oracle/.ssh/

  8. Change the permissions on the oracle user’s authorized file on all cluster nodes
  $ chmod 600 ~/.ssh/authorized_keys

  9. Enable OUI to use ssh and scp
  $ exec /usr/bin/ssh-agent $SHELL
  $ /usr/bin/ssh-add

  10. Verify ssh configuration on all nodes
  $ ssh rac1.localdomain date
  $ ssh rac2.localdomain date