Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

SSH_AUTH_SOCK tells an SSH client where to find the authentication agent’s Unix-domain socket. It is not a private-key path. To find the cause of an agent problem, check the variable in the exact shell or process where SSH fails, test the agent with ssh-add -L, and then check whether the intended key is loaded or forwarding is configured.

What SSH_AUTH_SOCK does

An SSH authentication agent holds loaded identities and performs authentication operations on their behalf. SSH_AUTH_SOCK contains the pathname of the Unix-domain socket through which a client communicates with that agent. The variable must be available to the process running SSH; a value in another terminal does not automatically reach a shell, IDE, container, or other session.

Use this sequence to identify which part is failing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. In the environment where the SSH command fails, print the variable: printf '%sn' "$SSH_AUTH_SOCK".
  2. If it is empty, arrange for the failing process to receive the active agent’s environment.
  3. If it contains a path, run ssh-add -L in that same environment to test communication and see which identities are available.
  4. If the agent responds but the intended identity is missing, add the key and list identities again.
  5. If the failure occurs after connecting to another host, check agent forwarding on both the client and server sides.

SSH_AUTH_SOCK is not set

An empty value means the failing process has no agent socket pathname in its environment. First check how the agent is started and how its environment is passed to the shell or application that runs SSH. OpenSSH documents two approaches: start a child command under ssh-agent, or have the agent print shell commands and evaluate them in the current shell. For Bourne-style shells, the documented form is eval "$(ssh-agent -s)"; use syntax appropriate to your actual shell rather than copying it into a different shell.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Check the variable where the SSH command actually runs. Starting an agent in one terminal does not set the variable in a separately opened terminal or an already-running application. If the agent was started elsewhere, configure or launch the failing process so it receives that agent’s environment. Startup and session management differ by operating system and agent manager, so there is no universal restart command.

The socket path exists, but the agent cannot be contacted

Run ssh-add -L in the same environment as the failing SSH command. If it cannot contact the agent, the socket path may not belong to a running agent, or the process may not have access to the socket. The ssh-add manual documents exit status 2 for inability to contact an agent. A nonempty SSH_AUTH_SOCK value alone does not prove the socket is live.

Rank #2
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Do not replace the value with a guessed socket path. Have the relevant agent establish or provide its actual socket path, then pass that agent environment to the failing process. Socket locations and startup behavior vary among platforms and OpenSSH versions; check the manuals for the versions installed on the client.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The agent responds, but the key is missing

An agent can be reachable without having any private keys loaded. Use ssh-add -L to list the identities exposed by the agent. If the intended key is absent, add it with ssh-add path/to/key, replacing path/to/key with the actual key-file path, then run ssh-add -L again.

Rank #3
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

On Apple systems, GitHub documents ssh-add --apple-use-keychain for use with Apple’s standard ssh-add. It is not a portable OpenSSH option; older macOS releases used different flags. Consult the documentation for the installed implementation before using platform-specific options.

SSH agent forwarding is not working on the remote host

Forwarding lets a remote host request authentication operations from the agent on your local machine. Diagnose it in stages:

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Confirm the local agent has the identity

Before connecting, run ssh-add -L locally and confirm that the key needed on the destination is listed. Forwarding cannot make an identity available if it is not loaded in the local agent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the client configuration

OpenSSH’s client default is ForwardAgent no. Check the applicable host-specific settings in the SSH client configuration as well as any command-line options or other configuration that may affect the connection. OpenSSH allows ForwardAgent to be set to yes, no, a socket path, or an environment-variable name. See the OpenBSD ssh_config(5) manual for the option and syntax supported by that implementation.

Best Value
FIDO2 U2F Security Key Passkey Two-Factor Authentication (2FA) USB Key PIN+Touch (Non-Biometric) USB-A Type TrustKey T110
  • Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
  • Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
  • Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
  • Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
  • For the driver download and user guide, please visit TrustKey Solutions Home support page.

Check server policy and the remote environment

The server-side AllowAgentForwarding setting controls whether forwarding is permitted. The OpenBSD sshd_config(5) manual documents a default of yes, but server configuration can override it. After connecting, inspect SSH_AUTH_SOCK on the remote host; GitHub’s guide to testing an SSH connection uses this check when troubleshooting forwarding. Then retry the target SSH authentication.

If the issue is with Git, confirm that the remote URL uses SSH. An HTTPS Git connection does not use the SSH agent.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Forwarding is a security decision

Forwarding does not send the private key itself over the network, but while forwarding is active a user on the remote host who can access the forwarded socket can use the loaded identities to authenticate. Forward only to hosts you trust, and leave it disabled where it is unnecessary. The OpenSSH client configuration manual warns: “Agent forwarding should be enabled with caution.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reference manuals

Options and defaults can differ across installed versions and platforms; check the manuals for the client and server you are using.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.