SSH & Remote Administration
Stop your SSH agent from holding onto old identities forever
š§© The Challenge
You know that feeling when you keep hitting āpermission deniedā even though you just updated your SSH key? It turns out your local SSH agent is just stubbornly re-offending with the old, expired key before the remote host even gets a chance to see the new one.
š” The Fix
You need to tell your client to only offer the keys you actually want to use for that specific host, skipping the agentās hoard entirely. This stops the ātoo many authentication failuresā error from killing your connection before you get a prompt.
Host myserver.com
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_specific
āļø Why It Works
Setting IdentitiesOnly to yes tells the client to ignore whatever keys are currently loaded in your agent and stick strictly to the file you defined. It forces a clean handshake every single time.
š Pro-Tip: Toss this in your ~/.ssh/config so you never have to deal with the agent clutter again.
Linux Tips & Tricks | Ā© ngelinux.com | 9/12/2026
