1、建立hadooop用户 useradd -d /home/hadoop -m hadoop
2、生成ssh密钥对 ssh-keygen -t rsa
3、将id_rsa.pub文件传,追加到 ~.ssh/authorized_keys 文件里
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys .
~/.ssh下面生成的文件:
[b]-rw-rw-r-- 1 hadoop hadoop 410 Sep 1 17:18 authorized_keys[/b]
-rw------- 1 hadoop hadoop 1675 Sep 1 16:53 id_rsa
-rw-r--r-- 1 hadoop hadoop 410 Sep 1 16:53 id_rsa.pub
-rw-r--r-- 1 hadoop hadoop 391 Sep 1 16:52 known_hosts
ssh localhost 结果还是需要输入密码
注意:
~/.ssh需要是700权限
authorized_keys 文件要600权限
-rw------- 1 hadoop hadoop 410 Sep 1 17:18 authorized_keys
成功
[hadoop@localhost .ssh]$ ssh localhost
Last login: Sun Sep 1 17:09:15 2013 from localhost.localdomain
2、生成ssh密钥对 ssh-keygen -t rsa
3、将id_rsa.pub文件传,追加到 ~.ssh/authorized_keys 文件里
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys .
~/.ssh下面生成的文件:
[b]-rw-rw-r-- 1 hadoop hadoop 410 Sep 1 17:18 authorized_keys[/b]
-rw------- 1 hadoop hadoop 1675 Sep 1 16:53 id_rsa
-rw-r--r-- 1 hadoop hadoop 410 Sep 1 16:53 id_rsa.pub
-rw-r--r-- 1 hadoop hadoop 391 Sep 1 16:52 known_hosts
ssh localhost 结果还是需要输入密码
注意:
~/.ssh需要是700权限
authorized_keys 文件要600权限
-rw------- 1 hadoop hadoop 410 Sep 1 17:18 authorized_keys
成功
[hadoop@localhost .ssh]$ ssh localhost
Last login: Sun Sep 1 17:09:15 2013 from localhost.localdomain