Linux ssh agent Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
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
- ssh-keygen Guide - Generate keys
- SSH Configuration - SSH setup
- ssh-add Guide - Key management
- ssh-agent Documentation:
man ssh-agent
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.