[andychen@node1 ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/andychen/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/andychen/.ssh/id_rsa. Your public key has been saved in /home/andychen/.ssh/id_rsa.pub. The key fingerprint is: 2e:57:e2:bf:fd:d4:45:5c:a7:51:3d:f1:51:3c:69:68 root@krusty04这个命令将为node1 上的当前用户 andychen 生成其密钥对,密钥对的保存路径使用缺省的 /home/andychen/.ssh/id_rsa, 要求输入 passphrase 的时候,直接回车。这样生成的证书以及公钥将存储在 /home/andychen/.ssh 目录,形成两个文件 id_rsa,id_rsa.pub。然后将 id_rsa.pub 文件的内容复制到每一台机器(包括本机 node1)的 /home/andychen/.ssh/authorized_keys 文件的尾部,如果机器上不存在 /home/andychen/.ssh/authorized_keys 文件,可以自行创建一个。请注意 id_rsa.pub 文件的内容是长长的一行,复制时需注意,不要遗漏字符或混入了多余换行符。
The authenticity of host [node1] can't be established. The key fingerprint is: 74:32:91:f2:9c:dc:2e:80:48:73:d4:53:ab:e4:d3:1a Are you sure you want to continue connecting (yes/no)?