The “Too many authentication failures” error is a common SSH problem that signals a misconfigured setup. After setting up multiple home servers recently, I’ve developed a clean solution that eliminates this issue entirely.
The Core Principle: Unique Keys Per Machine
The fundamental rule: every machine gets its own SSH key pair. Using a single key across multiple machines creates unnecessary security risks. If one machine is compromised, you must revoke that key across all services—GitHub, GitLab, every server. With unique keys, you revoke only the compromised machine’s key while maintaining access from other devices.
Key Generation and Management
I use 1Password for secure passphrase management, though any password manager works. The process for each new machine:
First, create a passphrase in 1Password named clearly, such as “SSH Passphrase - Mac Mini M4”. This protects the key if the disk is accessed.
Generate the key with a descriptive filename:
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_macmini -C "stefan@macmini"
The -f
flag specifies the filename, avoiding generic names like id_rsa
. When prompted, paste the passphrase from 1Password (characters won’t display during paste—this is normal).
For disaster recovery, backup the private key in 1Password. Run cat ~/.ssh/id_ed25519_macmini
, copy the entire output including BEGIN/END lines, and store it as an SSH Key item in 1Password. The key remains encrypted with your passphrase.
Repeat this process for each machine: id_ed25519_mac
for Mac, id_ed25519_linux
for Linux desktop, and so on.
SSH Config: The Solution to Authentication Failures
The “too many authentication failures” error occurs when SSH attempts every available key. Servers interpret this as a brute-force attempt and block the connection.
The solution is explicit key mapping in ~/.ssh/config
. On my Mac:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_mac
IdentitiesOnly yes
Host homeserver
HostName 192.168.1.100
User stefan
IdentityFile ~/.ssh/id_ed25519_mac
IdentitiesOnly yes
The critical directive is IdentitiesOnly yes
, which instructs SSH to use only the specified key, preventing authentication failures.
On my Linux desktop, the configuration uses the Linux-specific key:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_linux
IdentitiesOnly yes
Host homeserver
HostName 192.168.1.100
User stefan
IdentityFile ~/.ssh/id_ed25519_linux
IdentitiesOnly yes
Now ssh homeserver
connects immediately from any configured machine.
Automated Server Provisioning
Modern Linux installers offer an elegant solution for initial SSH setup. During Ubuntu Server installation, select “Import SSH identity from GitHub” and enter your GitHub username.
The installer fetches all public keys from github.com/yourusername.keys
and adds them to ~/.ssh/authorized_keys
. Your server is immediately accessible from all your machines upon first boot—no manual key distribution required.
The Current Relevance
With AMD’s efficient processors and widespread fiber internet, home servers have become practical again. The infrastructure improvements—symmetric high-speed connections and power-efficient hardware—make self-hosting viable.
This SSH setup scales elegantly. New machines simply need their key generated and added to GitHub. New servers import from GitHub during installation. If a machine is compromised, revoke one key without affecting other access.
The configuration takes minutes to implement but saves hours of troubleshooting. Each server provisioning requires only entering a GitHub username. The local config files handle all connection details automatically.
This approach provides security through key isolation, convenience through automated provisioning, and reliability through explicit configuration. It’s a professional setup that works consistently across any number of machines and servers.