操作
mini-yum服务器(A)
[root@sizhan ~]# 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:
4a:76:c4:87:8d:d9:bd:06:32:c2:a0:2f:94:2f:48:fa root@sizhan
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| o o . * . |
| .+ o O = . |
|oo o o + . . |
|o o o o S o |
| . o o o . |
| E . |
| |
| |
+-----------------+
[root@sizhan ~]# ll .ssh
总用量 12
-rw-------. 1 root root 1675 12月 4 17:58 id_rsa 私钥
-rw-r--r--. 1 root root 393 12月 4 17:58 id_rsa.pub 公钥
-rw-r--r--. 1 root root 397 12月 3 20:12 known_hosts
将A自己的公钥拷贝并追加到B的授权列表文件authorized_keys中
ssh-copy-id B(mini2)
[root@sizhan ~]# ssh-copy-id 192.168.232.129
reverse mapping checking getaddrinfo for bogon [192.168.232.129] failed - POSSIBLE BREAK-IN ATTEMPT!
root@192.168.232.129's password:
Now try logging into the machine, with "ssh '192.168.232.129'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@sizhan ~]#
验证