[root@DRBD01 ~]#cd

[root@DRBD01 ~]# cd .ssh
[root@DRBD01 .ssh]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.15.137 drbd01 node1 node1.drbd.org
192.168.15.138 drbd02 node2 node2.drbd.org
[root@DRBD01 .ssh]#
[root@DRBD01 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
43:4b:9a:bb:27:30:81:4d:78:9d:a6:ea:dc:51:c4:79 root@DRBD01
The key's randomart image is:
+--[ RSA 2048]----+
| . o o |
| . o B E |
| = + .o |
| . + .= . |
| . oo S |
| . + . . |
| o . +. |
| o . ... |
| .o |
+-----------------+
[root@DRBD01 .ssh]# ls
id_rsa id_rsa.pub known_hosts
[root@DRBD01 .ssh]# scp id_rsa.pub drbd02@:/root/.ssh/id_rsa.pub.drbd01
ssh: Could not resolve hostname : Name or service not known
lost connection
[root@DRBD01 .ssh]# scp ./id_rsa.pub drbd02:/root/.ssh/id_rsa.pub.drbd01
root@drbd02's password:
id_rsa.pub 100% 393 0.4KB/s 00:00
[root@DRBD01 .ssh]# cat id_rsa.pub.drbd02 >> authorized_keys
[root@DRBD01 .ssh]# chmod 600 authorized_keys

 

 

=======================================================================

[root@DRBD02 ~]# cd

[root@DRBD02 ~]# cd .ssh
[root@DRBD02 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?
[root@DRBD02 .ssh]#
[root@DRBD02 .ssh]#
[root@DRBD02 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
7b:bb:35:91:c7:ca:13:3f:69:15:f3:1e:20:05:40:a4 root@DRBD02
The key's randomart image is:
+--[ RSA 2048]----+
| o+.... |
| . . |
| E . . o |
| .o. +|
| S + o.o|
| . . * +.|
| . . * = .|
| . o + . |
| o. |
+-----------------+
[root@DRBD02 .ssh]# scp ./id_rsa.pub drbd01:/root/.ssh/id_rsa.pub.drbd02
root@drbd01's password:
id_rsa.pub 100% 393 0.4KB/s 00:00
[root@DRBD02 .ssh]# cat id_rsa.pub.drbd01 >> authorized_keys
[root@DRBD02 .ssh]# chmod 600 authorized_keys
[root@DRBD02 .ssh]# ssh drbd02
The authenticity of host 'drbd02 (192.168.15.138)' can't be established.
RSA key fingerprint is 4c:4f:4b:d5:d4:95:42:db:d9:c4:ba:a1:d7:9e:14:b0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'drbd02,192.168.15.138' (RSA) to the list of known hosts.
root@drbd02's password:

[root@DRBD02 .ssh]# ssh drbd01
Last login: Tue Nov 26 10:38:19 2013 from 192.168.15.138
[root@DRBD01 ~]# logout
Connection to drbd01 closed.

arrow
arrow
    全站熱搜

    echochio 發表在 痞客邦 留言(0) 人氣()