db2inst2@ha1:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/db2home/db2inst2/.ssh/id_rsa):
Created directory '/db2home/db2inst2/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /db2home/db2inst2/.ssh/id_rsa.
Your public key has been saved in /db2home/db2inst2/.ssh/id_rsa.pub.
The key fingerprint is:
82:17:52:2c:57:ae:b8:03:b6:1d:6f:0a:a3:c9:e9:c6 db2inst2@ha1
db2inst2@ha1:~> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/db2home/db2inst2/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /db2home/db2inst2/.ssh/id_dsa.
Your public key has been saved in /db2home/db2inst2/.ssh/id_dsa.pub.
The key fingerprint is:
7a:19:d2:b7:67:c7:d4:3b:0b:f3:a8:a0:cf:21:2a:84 db2inst2@ha1
db2inst2@ha1:~> cat ~/.ssh/id_rsa.pub >>
~/.ssh/authorized_keys
db2inst2@ha1:~> cat ~/.ssh/id_dsa.pub >>
~/.ssh/authorized_keys
db2inst2@ha1:~> ssh ha2 cat ~/.ssh/id_rsa.pub >>
~/.ssh/authorized_keys
The authenticity of host 'ha2 (192.168.56.173)' can't be established.
RSA key fingerprint is
63:42:c3:d4:06:51:dd:2c:86:93:41:df:01:92:80:0d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ha2,192.168.56.173' (RSA) to the list of known
hosts.
db2inst2@ha1:~> ssh ha2 cat ~/.ssh/id_dsa.pub >>
~/.ssh/authorized_keys
db2inst2@ha1:~> ssh ha2 date
Fri Jun 21 16:56:30 CST 2013
db2inst2@ha1:~> ssh ha2
Last login: Fri Jun 21 16:48:08 2013 from 192.168.56.171
db2inst2@ha2:~> exit
logout
Connection to ha2 closed.
由于还有第二块网卡,所以,需要将第二块网卡也配置ssh互信
ha1:~ # su - db2inst2
db2inst2@ha1:~> ssh ha2.localhost cat ~/.ssh/id_rsa.pub >>
~/.ssh/authorized_keys
db2inst2@ha1:~> ssh ha2.localhost cat ~/.ssh/id_dsa.pub >>
~/.ssh/authorized_keys
db2inst2@ha1:~> ssh ha2.localhost date
Fri Jun 21 17:50:51 CST 2013
db2inst2@ha1:~> ssh ha2.localhost
Last login: Fri Jun 21 16:56:36 2013 from 192.168.56.171
db2inst2@ha2:~> exit
logout
Connection to ha2.localhost closed.
db2inst2@ha1:~>
ha2:/db2home # su - db2inst2
:~> ssh ha1.localhost
Last
login: Fri Jun 21 16:56:55 2013 from 192.168.56.173
:~> exit
logout
Connection
to ha1.localhost closed.
:~>