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,如需转载请自行联系原作者





相关文章
|
算法 网络协议 安全
|
Shell Linux 网络安全
解决SSH登录用户执行的命令部分环境变量参数不生效的问题
问题概况 linux机器在/etc/profile配置完成环境变量后,SSH到目标机器执行命令,但是获取不到已配置的环境变量值。 例如场景: 在/etc/profile配置了http代理 export all_proxy=http://$PROXY_HOST:8118 export ftp_pr...
2535 0
|
分布式计算 Java Hadoop
Hadoop-2.8.0集群搭建、hadoop源码编译和安装、host配置、ssh免密登录、hadoop配置文件中的参数配置参数总结、hadoop集群测试,安装过程中的常见错误
25. 集群搭建 25.1 HADOOP集群搭建 25.1.1集群简介 HADOOP集群具体来说包含两个集群:HDFS集群和YARN集群,两者逻辑上分离,但物理上常在一起 HDFS集群: 负责海量数据的存储,集群中的角色主要有NameNode / DataNode YARN集群: 负责海量数据运算时的资源调度,集群中的角色主要有 ResourceManager /NodeManag
4754 0
|
网络安全 数据安全/隐私保护
SSH服务的几个超时参数 以及 类似DDOS攻击的方法
背景 sshd是Linux的一个常用的网络连接的服务,通常被用来远程连接,管理服务器。 一般我们很少去配置sshd,本文要给大家分享几个sshd的参数,有超时参数,有触发拒绝连接的参数等等。 如果你哪天遇到类似的问题,也行能帮助你找到问题的根源。 sshd 空闲超时参数 man
5967 0
|
1月前
|
监控 Ubuntu Linux
使用VSCode通过SSH远程登录阿里云Linux服务器异常崩溃
通过 VSCode 的 Remote - SSH 插件远程连接阿里云 Ubuntu 22 服务器时,会因高 CPU 使用率导致连接断开。经排查发现,VSCode 连接根目录 ".." 时会频繁调用"rg"(ripgrep)进行文件搜索,导致 CPU 负载过高。解决方法是将连接目录改为"root"(或其他具体的路径),避免不必要的文件检索,从而恢复正常连接。
|
6月前
|
安全 Linux Shell
Linux中SSH命令介绍
Linux中SSH命令介绍
149 2