Are there alternatives to the SSH_AUTH_SOCK environment variable for passing agent info to ssh?

What I'm looking for is something like -o SshAuthSockPath="/path/to/socket" but nothing like that seems to exist. Am I missing something? Is this somehow a terrible idea?

I'd like to be able to use a different agent for the initial ssh command and ProxyJump connection without needing a wrapper script.


You're looking for IdentityAgent. This was added in release 7.3 (2016-08-01). From the ssh_config manual:

         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
  • Looks like this is an option added in 7.3. It doesn't look like there's anything comparable in earlier versions – Paul Rubel Jan 17 at 19:54
  • @PaulRubel Yes, 7.3 (2016-08-01). – Kusalananda Jan 17 at 20:21
  • It also looks like the ability to use a dollar-sign environment variable was only added in 7.9. – Binary Phile Jan 24 at 21:03
  • @BinaryPhile What are you referring to? – Kusalananda Jan 24 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.