分类: LINUX
2006-09-28 15:22:32
1以oracle用户身份登入系统,或使用root登陆,然后使用su -将身份切换到oracle
2 在rac1,rac2上分别运行ssh-keygen -t rsa
oracle@rac2:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory '/home/oracle/.ssh'.
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:
71:c9:1c:d3:0a:35:41:41:81:64:e9:7a:0b:50:aa:aa oracle@rac2
oracle@rac2:~$
3 将rac1上oracle用户的公钥添加到rac1的.ssh/authorized_keys中
cat /home/oracle/.ssh/id_rsa.pub >>/home/oracle/.ssh/id_rsa.pub
4 复制rac2上oracle用户的公钥
oracle@rac1:~/.ssh$ ssh rac2 "cat .ssh/id_rsa.pub">>/home/oracle/.ssh/authorized_keys
Password:
oracle@rac1:~/.ssh$
5 将rac1的authorized_keys文件复制到rac2上
scp /home/oracle/.ssh/authorized_keys rac2:.ssh/
6 在rac1上运行如下命令
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
运行过程中将提示输入yes
在运行的过程中将会吧每个主机的公钥添加到known_hosts中
7 将rac1的known_hosts文件复制到rac2上
scp known_hosts rac2:.ssh/
8 在rac2上运行如下命令
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
在运行过程中将不会提示任何输入
重新启动机器