-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux ssh keygen Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to ssh-keygen on Linux, covering Arch Linux, CachyOS, and other distributions including SSH key generation, key pair creation, and secure authentication.
Basic usage:
# Generate SSH key
ssh-keygen -t ed25519
# -t = type (ed25519 recommended)Add comment:
# With email comment
ssh-keygen -t ed25519 -C "your_email@example.com"
# -C = commentRSA keypair:
# Generate RSA key
ssh-keygen -t rsa -b 4096
# -t = type (RSA)
# -b = bits (4096 recommended)ED25519 keypair:
# Generate ED25519 key (recommended)
ssh-keygen -t ed25519
# ED25519 is faster and more secureDefault location:
# Keys stored in:
~/.ssh/id_ed25519 # Private key
~/.ssh/id_ed25519.pub # Public keyCustom path:
# Custom location
ssh-keygen -t ed25519 -f ~/.ssh/my_key
# -f = file (custom filename)Show public key:
# Display public key
cat ~/.ssh/id_ed25519.pub
# Copy this to add to serversAdd to server:
# Copy public key to server
ssh-copy-id user@server
# Or manually:
cat ~/.ssh/id_ed25519.pub | ssh user@server "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"Fix permissions:
# Set correct permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
chmod 644 ~/.ssh/id_ed25519.pubThis guide covered ssh-keygen usage, SSH key generation, and key management for Arch Linux, CachyOS, and other distributions.
- SSH Configuration - SSH setup
- ssh-agent Guide - Key agent
- Security Configuration - Security setup
-
ssh-keygen Documentation:
man ssh-keygen
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.