Site icon New Generation Enterprise Linux

Stop your SSH agent from asking for passphrases on every single login

SSH & Remote Administration

Stop your SSH agent from asking for passphrases on every single login

🧩 The Challenge

Dealing with SSH agent timeouts is a special kind of hell when you’re jumping between half a dozen servers. I’ve spent way too much time re-typing passphrases while trying to emergency-patch a production box.

💡 The Fix

Use the ssh-add command with the lifetime flag to keep your keys cached for exactly as long as your session demands. It saves you from constantly re-authenticating while keeping your local machine reasonably secure.

ssh-add -t 8h ~/.ssh/id_ed25519

⚙️ Why It Works

Setting a lifetime limit forces the agent to drop the key after the specified duration, which strikes a decent balance between convenience and not leaving your private key wide open indefinitely.

🚀 Pro-Tip: Alias this to your login script so you don’t even have to remember the flag.

Linux Tips & Tricks | © ngelinux.com | 8/8/2026

0 0 votes
Article Rating
Exit mobile version