October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

SSH Agent vs. ssh-add: What Each One Does

An SSH agent holds key identities for SSH clients; ssh-add loads, lists, limits, and removes them. Here’s how the workflow and forwarding security work.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An SSH agent is a local process that holds private-key identities and performs authentication operations for SSH clients. The ssh-add command loads keys into an agent that is already running; it is not the agent itself. This lets SSH use a key without repeatedly opening its private-key file. The OpenBSD manuals describe the standard OpenSSH behavior, though defaults and setup can differ by operating system and version.

How an SSH agent and ssh-add work together

The agent usually runs as part of a login or desktop session and starts with no identities loaded. SSH clients locate it through the SSH_AUTH_SOCK environment variable, which identifies the agent’s communication socket. When you run ssh-add, it sends the requested key to that agent; if the private key is encrypted, you enter its passphrase locally.

As an Amazon Associate I earn from qualifying purchases.

In a shell session that already has an agent, a typical sequence is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh-add ~/.ssh/id_ed25519
ssh-add -l

The first command requests that the key be loaded. The second checks which identities the agent currently represents. Consult the OpenBSD ssh-agent(1) manual and OpenBSD ssh-add(1) manual for the documented behavior; installed versions may differ.

Adding and managing keys

Load a key

Give ssh-add a key-file path to request that specific identity, for example ssh-add ~/.ssh/id_ed25519. With no file argument, the current OpenBSD manual says it tries its documented default identity filenames and a matching certificate where available. Those defaults are version-sensitive and should not be assumed to match every platform.

Inspect or remove identities

Command Effect
ssh-add -l Lists fingerprints of identities represented by the agent.
ssh-add -L Lists public-key parameters for identities represented by the agent.
ssh-add -d ~/.ssh/id_ed25519 Removes the specified identity.
ssh-add -D Removes all identities from the agent.

Limit when or how a key can be used

ssh-add -t 1h ~/.ssh/id_ed25519 requests that the identity remain available for at most the specified lifetime; one hour is only an example. ssh-add -c ~/.ssh/id_ed25519 marks it for confirmation before authentication use. Destination constraints can be requested with ssh-add -h to restrict permitted host paths. The manual says these constraints were added in OpenSSH 8.9 and require cooperating SSH clients and servers for constrained keys over forwarding.

What to do if ssh-add cannot reach the agent

If ssh-add reports that it cannot connect to the authentication agent, either no agent is available to the shell or SSH_AUTH_SOCK does not point to its socket. OpenBSD documents two setup patterns: run a command under ssh-agent, or evaluate the environment commands printed by ssh-agent -s. Exact startup configuration varies among operating systems and login environments, so use the installed system’s manual and session setup rather than assuming one universal command sequence.

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

What agent forwarding does—and does not do

Agent forwarding lets a remote SSH session send authentication requests through the connection to the agent on your original machine. The private-key file and its passphrase are not sent to the remote host. However, a process on that host that can access the forwarded agent may ask it to perform authentication operations while access remains available. Forward only to hosts you trust. Destination constraints can narrow permitted paths when supported by cooperating clients and servers, but they do not remove every risk from a compromised forwarded session.

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

Optional hardware-backed keys

OpenSSH also supports FIDO authenticator keys. The OpenBSD ssh-add manual documents -K for loading resident keys from a FIDO authenticator and -S for selecting an authenticator middleware library. FIDO support is an optional key source, not a requirement for using an SSH agent; the agent applies restrictions to FIDO signatures by default.

Quick Recap

SaleBestseller No. 3
SSH, The Secure Shell: The Definitive Guide
SSH, The Secure Shell: The Definitive Guide
Used Book in Good Condition
$29.99
Bestseller No. 4
BookFactory Security Incident Report Log Book, Wire-O, 100 Pages
BookFactory Security Incident Report Log Book, Wire-O, 100 Pages
Made in USA - Proudly produced in Ohio by a Veteran-owned business; Wire-O, 100 Pages, Dimensions 3.5" x 5.25"
$9.99
Bestseller No. 5
BookFactory Security Pass Down Log Book, Wire-O, 100 Pages
BookFactory Security Pass Down Log Book, Wire-O, 100 Pages
Made in USA - Proudly produced in Ohio by a Veteran-owned business
$22.99
Best Value
BookFactory Security Pass Down Log Book, Wire-O, 100 Pages
  • Made in USA - Proudly produced in Ohio by a Veteran-owned business
  • Comprehensive Coverage: This BookFactory log book includes essential fields such as post/shift, time of change, date, weather conditions, and a designated space for detailed notes. This ensures that all relevant information is captured and easily accessible.
  • Sturdy Cover: The trans-lux cover protects the log book from wear and tear, ensuring its longevity and maintaining the integrity of your recorded data.
  • Essential Security Tool: This log book is an indispensable tool for any organization that values security and accountability. It helps to prevent misunderstandings, improve communication, and ensure a smooth transition between shifts.
  • Wire-O with Trans-lux cover, 100 Pages, Dimensions 8.5" x 11" - (Security-Pass-Down) Reorder SKU: LOG-100-7CW-PP(Security-Pass-Down)
Rank #4
BookFactory Security Incident Report Log Book, Wire-O, 100 Pages
  • Made in USA - Proudly produced in Ohio by a Veteran-owned business
  • This BookFactory log book is for security guards in any sector or business. You can report location, circumstances and report number.
  • There are spaces to log the individual's names address, description and other identifying information. There are also spaces to note others involved, notes, and vehicle information if one was involved
  • Wire-O, 100 Pages, Dimensions 3.5" x 5.25"
  • Reorder SKU: LOG-100-M3CW-PP(Security-Report)

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.