Skip to content

Linux ssh agent Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux ssh-agent Guide

Complete beginner-friendly guide to ssh-agent on Linux, covering Arch Linux, CachyOS, and other distributions including SSH key agent, key caching, and passwordless authentication.


Table of Contents

  1. Understanding ssh-agent
  2. ssh-agent Basics
  3. Adding Keys
  4. Agent Management
  5. Troubleshooting

Understanding ssh-agent

What is ssh-agent?

ssh-agent holds private keys in memory.

Uses:

  • Key caching: Cache decrypted keys
  • Passwordless auth: Avoid repeated passwords
  • Key management: Manage SSH keys
  • Security: Keep keys in memory

Why it matters:

  • Convenience: Avoid entering passphrase repeatedly
  • Security: Keys stay in memory
  • Automation: Enable automated SSH

ssh-agent Basics

Start Agent

Basic usage:

# Start ssh-agent
eval "$(ssh-agent -s)"

# Starts agent and sets environment

Check Agent

Verify running:

# Check agent
ssh-add -l

# Lists loaded keys

Adding Keys

Add Key

Add to agent:

# Add key to agent
ssh-add ~/.ssh/id_ed25519

# Adds key (prompts for passphrase)

Add All Keys

Add all:

# Add all default keys
ssh-add

# Adds default keys

Agent Management

List Keys

Show loaded keys:

# List keys
ssh-add -l

# Shows fingerprint of loaded keys

Remove Key

Delete key:

# Remove key
ssh-add -d ~/.ssh/id_ed25519

# -d = delete (removes key)

Troubleshooting

Agent Not Running

Start agent:

# Start agent
eval "$(ssh-agent -s)"

# Then add keys
ssh-add ~/.ssh/id_ed25519

Summary

This guide covered ssh-agent usage, key caching, and passwordless authentication for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally