命令行 SSH_AUTH_SOCK 的替代方案

命令行 SSH_AUTH_SOCK 的替代方案

是否有 SSH_AUTH_SOCK 环境变量的替代方案来将代理信息传递给 ssh?

我正在寻找类似的东西-o SshAuthSockPath="/path/to/socket",但似乎不存在这样的东西。我错过了什么吗?这是一个糟糕的主意吗?

我希望能够为初始 ssh 命令和 ProxyJump 连接使用不同的代理,而无需包装脚本。

答案1

您正在寻找IdentityAgent。这是在版本 7.3 (2016-08-01) 中添加的。从ssh_config手册中:

 IdentityAgent
         Specifies the UNIX-domain socket used to communicate with the
         authentication agent.

         This option overrides the SSH_AUTH_SOCK environment variable and
         can be used to select a specific agent.  Setting the socket name
         to none disables the use of an authentication agent.  If the
         string "SSH_AUTH_SOCK" is specified, the location of the socket
         will be read from the SSH_AUTH_SOCK environment variable.
         Otherwise if the specified value begins with a ‘$’ character,
         then it will be treated as an environment variable containing the
         location of the socket.

         Arguments to IdentityAgent may use the tilde syntax to refer to a
         user's home directory or the tokens described in the TOKENS
         section.

相关内容