采用rhosts方式的互信
配置远程权限
$ more /etc/hosts.equiv
+dbrac1 oracle
+dbrac2 oracle
+dbrac1-eth1 oracle
+dbrac2-eth2 oracle
测试命令 rsh rlogin rcp
测试RSH是否能正常工作,在节点1上查看远程节点的文件内容
[oracle@dbrac1 admin]$ rsh dbrac2 cat /etc/hosts.equiv
dbrac1 oracle
dbrac2 oracle
dbrac1-eth1 oracle
dbrac2-eth1 oracle
配置rhosts或hosts.equiv的用户必须设置有passwd,否则没有用
root帐户只能用rhosts文件配置信任关系,属主必须为root,属性必须为600
非root帐户通过用户根目录rhosts文件配置时,属主必须为自身,属性必须为600
/etc/passwd里面帐户的id重复(比如有多个id=0的root帐户),信任关系会混乱
==============================================================================
cd /etc/ssh
vi sshd_config 加入
PermitRootLogin yes
PubkeyAuthentication yes
service sshd restart
采用ssh方式的互信
A、 以oracle用户登录(不要su过去)
B、 创建ssh目录。
$ ls -a $HOME
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
C、 创建RSA-typekey
/usr/bin/ssh-keygen -t rsa 接受默认,并输入密码
生成如下文件
/home/oracle/.ssh/id_rsa.pub
/home/oracle/.ssh/id_rsa
D、 创建DSA type public and private keys
/usr/bin/ssh-keygen -t dsa
生成如下文件
/home/oracle/.ssh/id_dsa.pub
/home/oracle/.ssh/id_dsa
E、 在集群内所有机器上执行a-d,步骤
F、 使用安全cp。Scp 或者sftp ,将所有pub key cat到一个文件中,并分发到各个机器
cd ~/.ssh
cat id_rsa.pub >>authorized_keys
cat id_dsa.pub >>authorized_keys
scp authorized_keys docrac2:/home/oracle/.ssh/
注意:确保每一台机器上的authorized_keys包括所有节点的pubkey
G、 在安装软件的机器上使ssh生效
Enter the following commands:
$ exec /usr/bin/ssh-agent $SHELL
$ /usr/bin/ssh-add
验证
$ ssh oracle@rac2 验证信任关系是否生效(最好把root和oracle的都配置了),如果生效不应该提示输入密码
$ ssh rac1 date 命令 显示时间,而不提示密码后其他输入(第一次执行时有个结束密钥的过程,选择yes就可以了。之后就不用了)
ssh scp
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15711267/viewspace-776333/ ,如需转载,请注明出处,否则将追究法律责任。