ssh -A 参数使用示例

将公钥拷贝到192.168.90.164

[robin@90-96 ~]$ ssh-copy-id robin@192.168.90.164

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.

robin@192.168.90.164's password: 

Now try logging into the machine, with "ssh 'robin@192.168.90.164'", and check in:


  .ssh/authorized_keys


to make sure we haven't added extra keys that you weren't expecting.


[robin@90-96 ~]$ ssh robin@192.168.90.164

Last login: Wed May 20 17:24:23 2015 from 192.168.90.163

[robin@90-164 ~]$ logout

Connection to 192.168.90.164 closed.

[robin@90-96 ~]$

将公钥拷贝到192.168.90.165

[robin@90-96 ~]$ ssh-copy-id robin@192.168.90.165

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.

robin@192.168.90.165's password: 

Now try logging into the machine, with "ssh 'robin@192.168.90.165'", and check in:


  .ssh/authorized_keys


to make sure we haven't added extra keys that you weren't expecting.


[robin@90-96 ~]$ ssh robin@192.168.90.165

Last login: Wed May 20 17:24:19 2015 from 192.168.90.163

[robin@web90-dujia165 ~]$ logout

Connection to 192.168.90.165 closed.

[robin@90-96 ~]$

下来这一步最重要

[robin@90-96 ~]$ ssh-agent bash

welcome robin from /etc/profile.d

[robin@90-96 ~]$ ssh-add

Identity added: /home/robin/.ssh/id_rsa (/home/robin/.ssh/id_rsa)

[robin@90-96 ~]$ 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)

测试效果:

[robin@90-96 ~]$ ssh -A robin@192.168.90.164

Last login: Wed May 20 17:27:07 2015 from 192.168.90.96

[robin@90-164 ~]$ ssh -A 192.168.90.165

Last login: Wed May 20 17:26:49 2015 from 192.168.90.96

[robin@web90-dujia165 ~]$ logout

Connection to 192.168.90.165 closed.

[robin@90-164 ~]$ logout

Connection to 192.168.90.164 closed.

[robin@90-96 ~]$ 


      本文转自Tenderrain 51CTO博客,原文链接:http://blog.51cto.com/tenderrain/1653273,如需转载请自行联系原作者





上一篇:隐藏参数_high_priority_processes与oradism


下一篇:手机版制作H5页面免费工具大集合