Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get the following prompt everytime I try to connect a server using SSH. I type "yes", but is there a way to aovid this?

The authenticity of host '111.222.333.444 (111.222.333.444)' can't be established.
RSA key fingerprint is f3:cf:58:ae:71:0b:c8:04:6f:34:a3:b2:e4:1e:0c:8b.
Are you sure you want to continue connecting (yes/no)? 
share|improve this question

migrated from Mar 29 '10 at 12:38

This question came from our site for professional and enthusiast programmers.

/dev/null exists for those who think they are immune to man in the middle attacks :) – Tim Post Mar 29 '10 at 10:08
up vote 101 down vote accepted

Use the -o option,

ssh -o "StrictHostKeyChecking no" user@host
share|improve this answer
You may want to use an alternate identity file with the flag '-i' – MUY Belgium Apr 22 '13 at 10:08
What use would using an alternate identity file be? I mean, if you're connecting to a compromised host, what difference does it make how you authenticate - it's not like the compromised host can steal your key too. – Dagelf Jun 2 '15 at 10:16

Add the following lines to the beginning of /etc/ssh/ssh_config...

Host 192.168.0.*
   StrictHostKeyChecking no


  • The Host subnet can be * to allow unrestricted access to all IPs.
  • Edit /etc/ssh/ssh_config for global configuration or ~/.ssh/config for user-specific configuration.


share|improve this answer
Pity I can only upvote you once. Setting KnownHosts to /dev/null is genius. – J0hnG4lt Aug 8 '14 at 15:15
Your the smartest one. – user973810 Sep 5 '14 at 20:08
Ha! Tell my wife. – JimFred Sep 6 '14 at 21:16

You should only get this the first time you connect to a new host. After you respond yes the host gets stored in ~/.ssh/known_hosts and you won't get prompted the next time you connect.

Note that if ~/.ssh/known_hosts can not be written for any reason (e.g. permissions problem) then you will get prompted every time you connect.

share|improve this answer
+1, quite precise and correct answer. – Jack Mar 29 '10 at 9:52
The question is is there anyway to avoid the prompt? – shantanuo Mar 29 '10 at 10:44
I tried adding "CheckHostIP no" to /etc/ssh/ssh_config file. But it does not seem to be working – shantanuo Mar 29 '10 at 10:46
sudo chown -R user:user .ssh ; sudo chmod 700 .ssh; sudo chmod -R 600 .ssh/ ; ssh-keygen -R $hostname and reconnect that should take ALL problems out and ONLY ever re-prompt if a ssk_Hostkey is mucked with | changed or you are victim to a MITM. – linuxdev2013 Dec 12 '15 at 23:28

The best way (because it does not sacrifice security) is to connect once to all computers from one client (you'll be prompted every time, always answer yes). As pointed out in the other answer, the keys will then be stored in ~/.ssh/known_hosts. Then copy this file to every client computer you might later want to connect from (possibly for each user account you use). Then all these accounts will "know" the computers, hence no prompt.

The advantage over just disabling the prompt is that SSH can actually check if there is a MITM attack.

share|improve this answer
Although, if you often ssh via forward connections, you will want to add this to /etc/ssh/ssh_config: Host NoHostAuthenticationForLocalhost yes – Dagelf Jun 2 '15 at 10:14

If you want to disable the confirmation, rather than the authentication, you can use the option: "-o CheckHostIP=no"

ssh -i sergeys_rsa_key.pem -o CheckHostIP=no brin@
share|improve this answer
The OP has already got the same answer and accepted it. – Ayan Jul 12 '15 at 4:03

This is probably because your ssh key server changed, since server ip or domain is the same but ssh key mismatch.

You must remove the stored key in /home/$user/.ssh/known_hosts to avoid this message.

I fixed it removing all keys in that file, so new token is created for this domain name.

share|improve this answer
Key changed produces a much uglier message with a box of atsigns and WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! and IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! in all-caps. The message in the question occurs only if there is not already an entry in known_hosts. – dave_thompson_085 Dec 15 '15 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .