[root@ hadoop-m ~]$ mkdir .ssh //如果有 就不用创建了
[root@ hadoop-m ~]$ chmod 755 .ssh //加权限
[root @ hadoop-m ~]$ ssh-keygen -t rsa //生成秘钥
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): //无密码
Enter same passphrase again: //无密码回车
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
10:45:c4:2b:24:fe:95:16:33:25:5d:c3:07:20:6a:29 hadoop-m@master
[root @ hadoop-m ~]$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys
[root @ hadoop-m ~]$ cd .ssh /
[root @ hadoop-m .ssh]$ chmod 644 authorized_keys
[root @ hadoop-m.ssh]$ scp authorized_keys 192.168.10.34: /root/.ssh/
The authenticity of host '192.168.10.33 (192.168.10.34)' can't be established.
RSA key fingerprint is ad:32:f3:b6:c9:bf:49:57:f6:ea:dc:37:5d:99:d4:8a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.34' (RSA) to the list of known hosts.
[email protected]'s password: //输入根据ip的密码
authorized_keys 100% 395 0.4KB/s 00:00
[root @ hadoop-m .ssh]$ ssh hadoop-s1 date