密码中的 SSH 转义序列

标签 ssh putty

我需要从 SSL 私钥文件中删除密码。我正在使用

openssl rsa -in in.key.pem -out out.key.pem

要做到这一点。我面临的问题是该 key 文件的密码(密码是在某处不同的机器上生成的)看起来像这样:
~Casdfghetc

正如您可能已经发现的那样,该密码的“~C”部分会产生一个新的命令行,让我无法正确输入密码。引号,双引号等不起作用。
我正在使用 putty 连接到这个 shell,通过一个黄金主机(powerbroker)跳跃。这是一个高效、安全的环境,因此我无法以任何其他方式登录机器。关于如何让它发挥作用的任何提示?

最佳答案

方式1.作为http://www.jedi.be/blog/2010/08/27/ssh-tricks-the-usual-and-beyond/指出:

Escape sequences are only recognized after a newline



因此,当要求输入密码时,您可以执行以下操作:
  • 在输入密码之前输入一些字母,例如a .
  • 按退格键撤消/删除它。
  • 像往常一样输入您的密码。

  • 方式 2. 在我的系统上,按“~?”显示以下帮助:
    Supported escape sequences:
     ~.   - terminate connection (and any multiplexed sessions)
     ~B   - send a BREAK to the remote system
     ~C   - open a command line
     ~R   - request rekey
     ~V/v - decrease/increase verbosity (LogLevel)
     ~^Z  - suspend ssh
     ~#   - list forwarded connections
     ~&   - background ssh (when waiting for connections to terminate)
     ~?   - this message
     ~~   - send the escape character by typing it twice
    (Note that escapes are only recognized immediately after newline.)
    

    所以,要在换行符之后插入波浪号( ~ ),我只需按两次( ~~ )。可能对您的系统也是如此:只需键入 ~~Casdfghetc而不是 ~Casdfghetc .

    关于密码中的 SSH 转义序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32028387/

    相关文章:

    git - 如何为Git同步操作指定ppk?

    ssh - 将 ssh key 从 Windows 计算机复制到 Windows Server 2019

    svn - 从家里连接到企业防火墙后面的 SVN 服务器

    c++ - 阅读通过 PuTTY 传递的低级鼠标点击 Unix

    linux - vbscript 中的 Sendkeys 正在截断在 putty 终端中传递的 key

    linux - 如何通过 SSH 将文件从 Hostgator 直接移动到 Godaddy?可能的?

    linux - 如何通过 SSH 访问 Raspberry Pi Zero

    javascript - 如何从html或javascript等网页打开putty

    Linux 终端 : typing feedback gone, 换行符未显示

    ssh - 如何通过 java 的 hdfs 协议(protocol)访问 hadoop?