Linux ssh add Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux ssh-add Guide
Complete beginner-friendly guide to ssh-add on Linux, covering Arch Linux, CachyOS, and other distributions including adding SSH keys to agent, key management, and passwordless authentication.
Table of Contents
Understanding ssh-add
What is ssh-add?
ssh-add adds SSH keys to ssh-agent.
Uses:
- Add keys: Add keys to agent
- Key management: Manage loaded keys
- Passwordless auth: Enable passwordless authentication
- Key caching: Cache decrypted keys
Why it matters:
- Convenience: Avoid repeated passphrase entry
- Key management: Manage SSH keys
- Automation: Enable automated SSH
ssh-add Basics
Add Default Keys
Basic usage:
# Add default keys
ssh-add
# Adds default keys (~/.ssh/id_*)
List Keys
Show loaded keys:
# List loaded keys
ssh-add -l
# Shows fingerprint of loaded keys
Adding Keys
Add Specific Key
Add key:
# Add specific key
ssh-add ~/.ssh/id_ed25519
# Adds key (prompts for passphrase)
Add All Keys
Add all:
# Add all keys in ~/.ssh
ssh-add ~/.ssh/*
# Adds all keys
Key Management
Delete Key
Remove key:
# Remove key
ssh-add -d ~/.ssh/id_ed25519
# -d = delete (removes key)
Clear All Keys
Remove all:
# Clear all keys
ssh-add -D
# -D = delete all (removes all keys)
Troubleshooting
Agent Not Running
Start agent:
# Start agent first
eval "$(ssh-agent -s)"
# Then add keys
ssh-add ~/.ssh/id_ed25519
Summary
This guide covered ssh-add usage, key management, and passwordless authentication for Arch Linux, CachyOS, and other distributions.
Next Steps
- ssh-keygen Guide - Generate keys
- ssh-agent Guide - Key agent
- SSH Configuration - SSH setup
- ssh-add Documentation:
man ssh-add
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.