Your SSH client normally checks the identity of every server you connect to. Sometimes that gets in the way. Automated scripts can’t handle interactive prompts and in testing environments where host keys change constantly it makes verification pointless. You need the connection to just work.
Need to bypass it just once? Add this flag:
ssh -o StrictHostKeyChecking=no user@remote-host
SSH connects without asking. No prompt, no stored key.
If you’re repeatedly connecting to the same systems, configure your SSH client instead of adding flags every time.
Open your SSH config file:
nano ~/.ssh/config
The file might not exist yet. The command creates it.
Add this to disable checking everywhere:
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Every SSH connection from your machine skips verification. The UserKnownHostsFile /dev/null bit stops SSH from storing any host keys.
Better approach:
Host 192.168.1.10
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Host dev-server.example.com
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Only those hosts bypass the check. Everything else keeps the default security.
Lock down the config file permissions:
chmod 600 ~/.ssh/config
Host key checking exists to catch man-in-the-middle attacks. You’re removing that protection.
Internal networks where you trust the infrastructure? Fine. Testing systems where host keys change constantly? Makes sense. CI/CD pipelines that need to connect without human intervention? Reasonable use case.
Don’t disable it on production systems connected to untrusted networks. If you’re managing production SSH access at scale, look at SSH certificate authentication instead.
Want something between full verification and none at all?
Host *
StrictHostKeyChecking accept-new
This accepts new host keys automatically but still verifies servers you’ve connected to before. First connection goes through without a prompt, subsequent connections get checked.
Comes in handy if you’re adding SSH keys to GitHub or mounting remote file systems via SSH where you know the infrastructure but don’t want the initial prompt.
Get scalable resources with our VPS hosting with root access and optional software.
Get VPS HostingPerfect for websites and small businesses unlimited bandwidth with cPanel hosting.
Get cPanel Hosting