Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 start/stop lots of new instances as I'm learning to use Amazon EC2. Every temporary instance is added to the known_hosts file. Is this ever a problem for others who use EC2 a lot?

I'd like to tell ssh to skip this step anytime I connect to Is there a way to do that in the config? I'm using Linux & openssh.

share|improve this question
up vote 2 down vote accepted

This is done to prevent Man in the Middle attacks. Disabling it would disable basic functionality of the ssh tools.

You may want to keep a copy of your .ssh/known_hosts file without the entries and replace it when you are done.

share|improve this answer
You can create a simple bash function for these such as ecssh () { ssh $1; cp .ssh/saved_hosts .ssh/known_hosts } <-- That syntax isn't exact, but it shows the idea. – Doug Harris Jan 25 '11 at 15:30
Thanks. I believe for EC2 you're supposed to check the fingerprint with the instance's system log. – projectshave Jan 25 '11 at 21:39
Found the issue with my syntax. Needs a semicolon after the cp command: ecssh () { ssh $1; cp .ssh/saved_hosts .ssh/known_hosts; } – Doug Harris Jan 26 '11 at 16:28

Try this:

ssh -q -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i $MYKEY $MYUSERNAME@$MYIP $MYCOMMAND

You can also do this in your config file:

Host *
  User root
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel QUIET
share|improve this answer

Your Answer


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.