Stop fighting SSH host key warnings when your server IPs recycle

SSH & Remote Administration

Stop fighting SSH host key warnings when your server IPs recycle

🧩 The Challenge

You’ve probably dealt with that annoying warning about a remote host identification change after redeploying a container or spinning up a new VM on an old IP. It stops your automation cold and looks like a man-in-the-middle attack when it’s really just the cloud being the cloud.

💡 The Fix

Tell SSH to stop being so paranoid about IPs and rely solely on the hostnames, or just accept that the IP footprint is going to be messy. It keeps your scripts running without throwing a tantrum every time a server reboots.

ssh -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/dev/null user@host

⚙️ Why It Works

By sending the known hosts to /dev/null, you effectively tell the client to stop tracking them for that session, while accept-new automatically adds unknown hosts instead of failing. It keeps your logs clean and your sanity intact.

🚀 Pro-Tip: Use the -o option in your ~/.ssh/config file for specific blocks so you don’t have to type it every single time.

Linux Tips & Tricks | © ngelinux.com | 10/1/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted