master
[uhadoop@master ~]$ mkdir ~/.ssh
[uhadoop@master ~]$ chmod 755 ~/.ssh
[uhadoop@master ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_rsa.
Your public key has been saved in /home/uhadoop/.ssh/id_rsa.pub.
The key fingerprint is:
85:fb:1f:d1:01:39:f5:fd:39:f0:cc:ea:9f:02:cc:06 uhadoop@master
The key's randomart image is:
+--[ RSA 2048]----+
| .o. |
| . o. ..|
| . . o. o|
| E .=.o|
| S + . .*.|
| . = .. .|
| o o. |
| ..o .|
| ..oo |
+-----------------+
[uhadoop@master ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_dsa.
Your public key has been saved in /home/uhadoop/.ssh/id_dsa.pub.
The key fingerprint is:
cf:21:a7:cb:53:14:37:bd:eb:a8:18:20:0b:a5:19:7e uhadoop@master
The key's randomart image is:
+--[ DSA 1024]----+
| . |
| . o . |
| . . o . . |
| . = . . |
| = E . S.o . |
| o o . *.. . |
| . o.o o |
| ..+ . . |
| +... |
+-----------------+
[uhadoop@master ~]$
node1
[uhadoop@node1 /]$ mkdir ~/.ssh
[uhadoop@node1 /]$ chmod 755 ~/.ssh
[uhadoop@node1 /]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_rsa.
Your public key has been saved in /home/uhadoop/.ssh/id_rsa.pub.
The key fingerprint is:
c5:13:c5:28:ef:99:4e:19:0f:8c:a9:32:03:18:0c:8f uhadoop@node1
The key's randomart image is:
+--[ RSA 2048]----+
|+ .+. |
|.+ ..... |
|Eo. *+ |
|. . o.=. |
| . .S. B |
| + . * . |
| + o |
| . |
| |
+-----------------+
[uhadoop@node1 /]$
[uhadoop@node1 /]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_dsa.
Your public key has been saved in /home/uhadoop/.ssh/id_dsa.pub.
The key fingerprint is:
a5:cb:21:e6:ea:6c:1b:bc:e0:6d:a0:af:c6:b2:9e:3d uhadoop@node1
The key's randomart image is:
+--[ DSA 1024]----+
| |
| |
| . |
| o |
| o S |
| .. o o o |
|....o . o |
|o+oEo+ |
|**o=O. |
+-----------------+
[uhadoop@node1 /]$
node2
[uhadoop@node2 /]$ mkdir ~/.ssh
[uhadoop@node2 /]$ chmod 755 ~/.ssh
[uhadoop@node2 /]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_rsa.
Your public key has been saved in /home/uhadoop/.ssh/id_rsa.pub.
The key fingerprint is:
a0:36:29:f4:6a:65:8c:1a:0e:6b:7b:71:c7:12:4b:ab uhadoop@node2
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . . |
| . + = . |
|o o @ = S |
|o+ B * o |
|ooo + o |
|...E |
| .. |
+-----------------+
[uhadoop@node2 /]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/uhadoop/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/uhadoop/.ssh/id_dsa.
Your public key has been saved in /home/uhadoop/.ssh/id_dsa.pub.
The key fingerprint is:
a4:95:c4:8b:76:71:71:d5:c4:9b:9f:bb:cb:6d:5e:ef uhadoop@node2
The key's randomart image is:
+--[ DSA 1024]----+
| .. .....+.|
| .o... o|
| .++ o|
| o+o o |
| ...S o|
| ..|
| o|
| ..=|
| BE|
+-----------------+
以上用默认配置,一路回车即可
master
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node1 cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
或
ssh uhadoop@node1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
grid@linuxrac1 ~]$ cd .ssh
[grid@linuxrac1 .ssh]$ ll
total 48
-rw-r--r-- 1 grid oinstall 2000 Sep 25 00:48 authorized_keys
-rw------- 1 grid oinstall 668 Sep 25 00:43 id_dsa
-rw-r--r-- 1 grid oinstall 604 Sep 25 00:43 id_dsa.pub
-rw------- 1 grid oinstall 1675 Sep 25 00:42 id_rsa
-rw-r--r-- 1 grid oinstall 396 Sep 25 00:42 id_rsa.pub
-rw-r--r-- 1 grid oinstall 404 Sep 25 00:48 known_hosts
node1
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@master cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
或
ssh uhadoop@master cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@master cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
node2
cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@master cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node1 cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
或
ssh uhadoop@master cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@master cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh uhadoop@node1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
测试连通性:
[uhadoop@master ~]$ ssh 10.10.36.101
[uhadoop@node1 ~]$ ssh 10.10.36.123
[uhadoop@node2 ~]$ ssh 10.10.36.101
Last login: Sat Dec 6 23:38:05 2014 from master
[uhadoop@node1 ~]$
[uhadoop@node1 /]$ ssh 10.10.36.123
Last login: Sat Dec 6 23:38:19 2014 from node1
[uhadoop@node2 ~]$ ssh 10.10.36.100
[uhadoop@master ~]$
[uhadoop@node2 /]$ ssh 10.10.36.100
Last login: Sat Dec 6 23:39:05 2014 from node2
[uhadoop@master ~]$ ssh 10.10.36.101
Last login: Sat Dec 6 23:39:28 2014 from node2
[uhadoop@node1 ~]$
|