将公钥拷贝到192.168.90.164
[[email protected] ~]$ ssh-copy-id [email protected]
The authenticity of host ‘192.168.90.164 (192.168.90.164)‘ can‘t be established.
RSA key fingerprint is 89:3c:a6:5c:a3:ee:e4:39:89:23:12:87:66:63:13:21.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.90.164‘ (RSA) to the list of known hosts.
[email protected]‘s password:
Now try logging into the machine, with "ssh ‘[email protected]‘", and check in:
.ssh/authorized_keys
to make sure we haven‘t added extra keys that you weren‘t expecting.
[[email protected] ~]$ ssh [email protected]
Last login: Wed May 20 17:24:23 2015 from 192.168.90.163
[[email protected] ~]$ logout
Connection to 192.168.90.164 closed.
[[email protected] ~]$
将公钥拷贝到192.168.90.165
[[email protected] ~]$ ssh-copy-id [email protected]
The authenticity of host ‘192.168.90.165 (192.168.90.165)‘ can‘t be established.
RSA key fingerprint is 89:3c:a6:5c:a3:ee:e4:39:89:23:12:87:66:63:13:21.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.90.165‘ (RSA) to the list of known hosts.
[email protected]‘s password:
Now try logging into the machine, with "ssh ‘[email protected]‘", and check in:
.ssh/authorized_keys
to make sure we haven‘t added extra keys that you weren‘t expecting.
[[email protected] ~]$ ssh [email protected]
Last login: Wed May 20 17:24:19 2015 from 192.168.90.163
[[email protected] ~]$ logout
Connection to 192.168.90.165 closed.
[[email protected] ~]$
下来这一步最重要
[[email protected] ~]$ ssh-agent bash
welcome robin from /etc/profile.d
[[email protected] ~]$ ssh-add
Identity added: /home/robin/.ssh/id_rsa (/home/robin/.ssh/id_rsa)
[[email protected] ~]$ ssh-add -l
2048 ec:d6:ac:e0:57:e5:8a:fb:0e:cf:fc:12:4e:3b:2e:93 /home/robin/.ssh/id_rsa (RSA)
测试效果:
[[email protected] ~]$ ssh -A [email protected]
Last login: Wed May 20 17:27:07 2015 from 192.168.90.96
[[email protected] ~]$ ssh -A 192.168.90.165
Last login: Wed May 20 17:26:49 2015 from 192.168.90.96
[[email protected] ~]$ logout
Connection to 192.168.90.165 closed.
[[email protected] ~]$ logout
Connection to 192.168.90.164 closed.
[[email protected] ~]$