<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ssh-Agent on Java 技术探秘</title>
    <link>https://www.szlinkroutes.com/tags/ssh-agent/</link>
    <description>Recent content in Ssh-Agent on Java 技术探秘</description>
    <generator>Hugo</generator>
    <language>zh-CN</language>
    <lastBuildDate>Wed, 02 Dec 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.szlinkroutes.com/tags/ssh-agent/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>deepin下深度终端使用ssh-agent</title>
      <link>https://www.szlinkroutes.com/categories/%E6%97%A5%E5%B8%B8%E8%AE%B0%E5%BD%95/2020-12-02-deepin%E4%B8%8B%E6%B7%B1%E5%BA%A6%E7%BB%88%E7%AB%AF%E4%BD%BF%E7%94%A8ssh-agentxshell%E4%B8%AD%E7%9A%84xagent%E5%8A%9F%E8%83%BD/</link>
      <pubDate>Wed, 02 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://www.szlinkroutes.com/categories/%E6%97%A5%E5%B8%B8%E8%AE%B0%E5%BD%95/2020-12-02-deepin%E4%B8%8B%E6%B7%B1%E5%BA%A6%E7%BB%88%E7%AB%AF%E4%BD%BF%E7%94%A8ssh-agentxshell%E4%B8%AD%E7%9A%84xagent%E5%8A%9F%E8%83%BD/</guid>
      <description>背景：从windows10换到deepin后，在连接公司的服务器遇到了问题：windows下用的是xshell，开启xagent后，可直接从公司的跳转板上连接生产服务器；在deepin的深度终端上，从公司的跳板机连接到生产服务器时，提示需要public key。baidu+google几次之后，终于解决了这个问题。&#xA;在深度终端中，实现像xshell下那样，快速地登录生产服务器，至少要解决两个问题：&#xA;开启ssh-agent（在xshell下只需勾选xagent即可） 免密码输入 深度终端中自带了远程服务器的管理功能，可惜的是，并不支持ssh-agent功能，因此只能自主实现了。&#xA;关于如何开启ssh-agent方法，主要是使用以下命令：&#xA;eval `ssh-agent` 对于如何免密码输入，可以使用expect功能，实现密码自动输入。幸运的是，expect在deepin上已经默认安装了，不能再去折腾安装过程了。&#xA;我使用的shell脚本如下：&#xA;#!/bin/bash # # ssh 连接方法，开启ssh-agent # connect() { #开启ssh-agent eval `ssh-agent` #使用expect实现密码自动输入 expect -c &amp;#34; spawn ssh-add $1 #Enter passphrase for /home/root/.ssh/id_rsa: expect &amp;#34;*passphrase*&amp;#34; send -- $3\r spawn ssh -A fangchengyan@$2 -p $4 -i $1 #Enter passphrase for key &amp;#39;/home/root/.ssh/id_rsa&amp;#39;: expect &amp;#34;*passphrase*&amp;#34; send -- $3\r interact exit &amp;#34; exit } PASSWORD=&amp;#34;password&amp;#34; SSH_KEY=&amp;#34;/home/root/.ssh/id_rsa&amp;#34; SERVER=&amp;#34;192.168.0.1&amp;#34; PORT=22 # # 使用时，可根据编号，自主选择要连接的服务器 # echo &amp;#39;请选择：&amp;#39; echo &amp;#39;1) 跳板机1-192.</description>
    </item>
  </channel>
</rss>
