搭建Hadoop集群的時(shí)候一定會(huì)用到的就是SSH免密碼登錄
1.[Hadoop@hadoop1 ~]$ ssh-keygen -t rsa
2.Generating public/private rsa key pair. 3.Enter file in which to save the key (/home/Hadoop/.ssh/id_rsa):
4.Enter passphrase (empty for no passphrase): 5.Enter same passphrase again:
6.Your identification has been saved in /home/Hadoop/.ssh/id_rsa.
7.Your public key has been saved in /home/Hadoop/.ssh/id_rsa.pub. 8.The key fingerprint is:
9.26:96:da:89:60:3d:90:75:43:bf:eb:56:d1:52:d9:68 Hadoop@hadoop1 10.The key's randomart image is:
11.+--[ RSA 2048]----+ 12.| ..+ + |
13.| o . o E . |
14.| o . + |
15.| o . .o . |
16.| o o + S o |
17.| . . * + .. |
18.| o o .. |
19.| .. |
20.| .. |
21.+-----------------+
22.[Hadoop@hadoop1 ~]$ cd .ssh 23.[Hadoop@hadoop1 .ssh]$ scp -r id_rsa.pub hadoop@hadoop3:/home/hadoop/.ssh/authorized_keys 24.The authenticity of host 'Hadoop3 (192.168.127.120)' can't be established. 25.RSA key fingerprint is 03:be:af:08:19:27:6d:15:7e:dd:90:fa:09:b3:14:2f. 26.Are you sure you want to continue connecting (yes/no)? yes 27.Warning: Permanently added 'Hadoop3,192.168.127.120' (RSA) to the list of known hosts. 28.Hadoop@hadoop3's password: 29.id_rsa.pub 100% 396 0.4KB/s 00:00 30.[Hadoop@hadoop1 .ssh]$ ssh hadoop3 31.Last login: Sat Aug 4 17:35:22 2012 from Hadoop1 如果不能沒(méi)有成功
方法一:
1.[Hadoop@hadoop3 ~]$ chmod 700 .ssh/
2.[Hadoop@hadoop3 ~]$ cd .ssh
3.[Hadoop@hadoop3 .ssh]$ chmod 600 authorized_keys
方法二:
1.[root@Hadoop3 .ssh]# vi /etc/ssh/sshd_config
2.AuthorizedKeysFile .ssh/authorized_keys 把前面的#號(hào)去掉
3.[root@Hadoop3 .ssh]# /etc/rc.d/init.d/sshd restart
4.Stopping sshd: [ OK ]
5.Starting sshd: [ OK ]
本文出自:億恩科技【1tcdy.com】
服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|