执行: ssh-keygen -t rsa
ssh-keygen -t dsa
rac1>cat ~./ssh/id_rsa.pub >> authorized_keys
rac1是本地主机
结果:
1.root用户执行:ssh rac1 date时不需要输入用户密码
2.oracle用户下执行ssh rac1 date时则需要输入密码
3.rac2用上面的命令配置却没有出错.
ssh-keygen -t dsa
rac1>cat ~./ssh/id_rsa.pub >> authorized_keys
rac1是本地主机
结果:
1.root用户执行:ssh rac1 date时不需要输入用户密码
2.oracle用户下执行ssh rac1 date时则需要输入密码
3.rac2用上面的命令配置却没有出错.
$ mkdir ~/.ssh
$ chmod 755 ~/.ssh
$ /usr/bin/ssh-keygen -t rsa只需要关注ORACLE用户。
$ /usr/bin/ssh-keygen -t rsa
命令会
将公共密钥写入 ~/.ssh/id_rsa.pub 文件
将私有密钥写入 ~/.ssh/id_rsa 文件
$ /usr/bin/ssh-keygen -t dsa
命令会
将公共密钥写入 ~/.ssh/id_dsa.pub 文件
将私有密钥写入 ~/.ssh/id_dsa 文件 两个命令都会提示确认生成文件的路径和密码,密码可为空。这些密钥不能随意传递给其它
机器。 [oracle@linuxrac9 .ssh]$ /usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
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:
99:0d:1e:cb:7c:12:09:02:15:78:3e:f9:55:e7:12:38 oracle@linuxrac9
[oracle@linuxrac9 .ssh]$ /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
3e:43:04:7e:23:1c:87:25:74:9b:ef:53:42:17:af:79 oracle@linuxrac9
确定所有节点上是否已经存在授权密钥文件 (~/.ssh/authorized_keys),我们将在所有节点机上
重新创建,同样在某台节点机(如linuxrac9)的oracle用户下运行: $ touch ~/.ssh/authorized_keys
$ ssh linuxrac9 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ ssh linuxrac9 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ ssh linuxrac6 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ ssh linuxrac6 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys 命令执行会提示一些信息,按提示执行即可。
在linuxrac9上,我们在授权密钥文件 (~/.ssh/authorized_keys) 中已经获得了来自集群中各个节点
的 RSA 和 DSA 公共密钥内容。现在将其复制到集群中的其余节点。双节点集群中,剩下的节点就是
linuxrac6。使用 scp 命令将授权密钥文件复制到集群中的其余所有节点:
$ scp ~/.ssh/authorized_keys linuxrac6:~/.ssh/authorized_keys
最后在所有节点下测试ssh,第一次需要密码,以后不用,方法与rsh相同:
$ ssh linuxrac9 date
$ ssh linuxrac6 hostname
$ ssh linuxrac9-priv date
$ ssh linuxrac6-priv hostname
是虚拟机版本问题,要用VM server版才可以的,之前我用的是VM station/感谢上面各位的回复!
不要误解了VM STATION. 我有一段时间一直用它, 肯定是可以建立SSH等效性的.
需要以oralce登录,来生产那些文件的才行的。