直接回车,无需输入密码
[root@rhel6 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
18:5c:35:a5:d5:5e:70:f2:28:de:7f:9b:a9:ad:4e:62 root@rhel6.5
The key's randomart image is:
+--[ RSA 2048]----+
|..o.o.o..|
| . . + .=.|
| o . .....|
| o . o. |
| . S . . |
| . |
| E . o|
| . o . =|
|.+o= |
+-----------------+
[root@rhel6 ~]# cd .ssh/
[root@rhel6 .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
[root@rhel6 .ssh]# cp id_rsa.pub authorized_keys
[root@rhel6 .ssh]# ssh 192.168.10.30
Last login: Mon Aug 19 16:37:40 2019 from 192.168.10.30
[root@rhel6 ~]#
[root@rhel6 ~]#
[root@rhel6 ~]#
ps:id_rsa.pub是公钥,存放在远程服务器上 '~/.ssh/authorized_keys',