但是目前我们的SSH连接还需要输入密码,下面将介绍使用密钥进行连接,免去了输入密码的烦恼:
1、在被管理机上生产密钥
[url=][/url]
1 [root@localhost ~]# mkdir /root/.ssh 2 [root@localhost ~]# ssh-keygen -t rsa 3 Generating public/private rsa key pair. 4Enter file in which to save the key (/root/.ssh/id_rsa): ##直接回车默认路径 5 Enter passphrase (empty for no passphrase): ##输入密码短语 6 Enter same passphrase again: ##重复密码短语 7 Your identification has been saved in /root/.ssh/id_rsa. ##如果在这里报错是因为SeLinux引起的按照Policy:yum install selinux-policy 8 Your public key has been saved in /root/.ssh/id_rsa.pub. 9 The key fingerprint is: 10aa:76:71:1e:51:fe:3b:4c:51:30:b2:90:55:e9:58:7c root@localhost.localdomain 11 The key's randomart image is: 12 +--[ RSA 2048]----+ 13 | .ooo+o | 14 | ...o+.E | 15 | o.+ o | 16 | . o o | 17 | S. . . | 18 | ..o o | 19 | .+ . o . | 20 | ... . + | 21 | ... . | 22 +-----------------+ [url=][/url]