Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to disable strict host key checking in ssh for ubuntu 11.04. How to do it?

share|improve this question
5  
Hi karthick87, I hope you understand the security implications of making that change ;) –  bodhi.zazen Dec 13 '11 at 16:18
    
It should be noted however, that you want to know if a host key has changed. That is a big red flag that someone may be spoofing the host. So UserKnownHostFile /dev/null is a really bad idea. –  Professional SysAdmin Apr 25 at 13:48
    
SSH is used not only for remote connections, you know. All hosts I'm connecting to are in heap on my table and share the same IP, so I always have the new host warning. –  Barafu Albino Sep 10 at 8:34

4 Answers 4

up vote 35 down vote accepted

In your ~/.ssh/config (if this file doesn't exist, just create it):

Host *
    StrictHostKeyChecking no

This will turn it off for all hosts you connect to. You can replace the * with a hostname pattern if you only want it to apply to some hosts.

share|improve this answer
    
There is no file named config in my home directory. –  karthick87 Dec 14 '11 at 14:40
1  
Make one - the entire contents of the file are in my quote above. Note it's in the .ssh subdirectory of your homedir as well. –  Caesium Dec 14 '11 at 14:44

Rather than adding it to your ~/.ssh/config file for all Host *, it would be a safer to specify a particular host.

You can also pass a parameter on the command-line like this:

ssh -o StrictHostKeyChecking=no yourHardenedHost.com
share|improve this answer
    
Note that you generally only need to do this once per host since it says this the first time: Warning: Permanently added 'frxxx.blaps.net,10.11.12.13' (RSA) to the list of known hosts. –  MarkHu Jul 24 '13 at 0:49

I don't have the rep yet to comment above - but it's worth pointing out:

StrictHostKeyChecking no

Will mean hostkeys are still added to .ssh/known_hosts - you just won't be prompted about whether you trust them, but should hosts change I'm willing to bet you'll get the big warning about it. You can work around this problem by adding another parameter:

UserKnownHostsFile /dev/null

This will add all these "newly discovered" hosts to the trash bin. If a host key changes, no troubles.

I would be remiss not to mention that circumventing these warnings on hostkeys has obvious security ramifications - you should be careful that you're doing it for the right reasons & that what you're connecting to actually is what you mean to connect to and not a malicious host.

share|improve this answer
    
You're correct, you do get the big warning –  Freedom_Ben Jan 20 at 17:35

FYI. I prefer to disable host checking just when using cssh.

alias cssh='cssh -o "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"'
share|improve this answer
    
cssh or ssh? –  kenorb Jan 16 at 14:29
    
Maybe he uses cssh.sourceforge.net –  MarkHu Jan 31 at 3:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.