小编Mis*_*erZ的帖子

在命令行中将 SSH ForwardAgent 和 ProxyJump 与 IdentityFile 结合使用

我在 SSH 中使用了新的 ProxyJump 选项。我在使用代理的 IdentityFile 时遇到问题。

示例 SSH 配置:

Host proxy
     HostName 1.0.0.1
     User foo
     Port 1234
     Identityfile ~/.ssh/mykey.id_rsa

Host target
     HostName 1.0.1.1
     User bar
     Port 5678
     Identityfile ~/.ssh/mykey.id_rsa
     ProxyJump proxy
     ForwardAgent yes
Run Code Online (Sandbox Code Playgroud)

示意图:

            ssh          ssh
localhost ------> proxy ------> target
             ^             ^
           using         using
           mykey         mykey
Run Code Online (Sandbox Code Playgroud)

在此配置中使用 ssh 命令可以解决:

ssh target
Run Code Online (Sandbox Code Playgroud)

我试图在没有配置文件的情况下执行此操作,但它不起作用:

ssh -i ~/.ssh/mykey.id_rsa -AJ foo@1.0.0.1:1234 bar@1.0.1.1:5678
Run Code Online (Sandbox Code Playgroud)

我找不到-i为 ProxyJump 主机和目标主机指定 IdentityFile以使其工作的方法。

这有效:

ssh -i ~/.ssh/mykey.id_rsa -AJ proxy bar@1.0.1.1:5678
Run Code Online (Sandbox Code Playgroud)

是否有使用的一种方式-i-A-J或 …

linux ssh proxy command-line

12
推荐指数
1
解决办法
9905
查看次数

标签 统计

command-line ×1

linux ×1

proxy ×1

ssh ×1