$ssh-keygen -t rsa
$cd .ssh
这里要注意,执行完命令后要选择生成文件所放的位置,按回车即选择默认即可。
[hadoop@localhost ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop /.ssh/id_rsa): (此处按回车)
Created directory '/home/hadoop/.ssh'.
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:
23:a8:36:c7:c3:89:1a:f9:97:00:88:36:73:d6:5a:0b hadoop@localhost
The key's randomart image is:
+----+
| |
| |
|o . |
|++ E + |
|..= = o S |
| ..* o . . |
|o =.*. |
| = oo. |
|. .. |
2. 把公钥追加到此文件:
$cat id_rsa.pub > authorized_keys