Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 output if I run the following command:

-bash-3.2$ ssh -o "StrictHostKeyChecking no"
Warning: Permanently added '' (RSA) to the list of known hosts.
Last login: Fri Jul  4 10:49:11 2014 from chlorine.example.com
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005

I would like to run this command, without being added to the list of known hosts, but still permitting a successful login.

Is there an SSH option that allows this? I have gone through the man page for ssh_config and I've tried all the likely options such as setting "CheckHostIP no" with no success.

Both the local and remote systems are running Solaris 10.

If necessary, I could back up my $HOME/.ssh/known_hosts file prior to making a connection, and restore it after making the connection, but if there is an SSH option that allows me to avoid doing this, then I would prefer to use that.

share|improve this question
up vote 14 down vote accepted

I see couple of more options from the answer here.

Option 1:

-o "UserKnownHostsFile /dev/null"

Option 2:

If you want this behavior because you're working with cloud servers (AWS EC2, Rackspace CloudServers etc.) or you're constantly provisioning new images in Vagrant you may want to update your SSH config instead of adding bash aliases or more options on the command line.

Consider adding something like:

  Host *.mydomain.com 
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  User foo
  LogLevel QUIET
  • Use as strict as regex for host as possible to be secure.
  • Setting the LogLevel to QUIET will keep the Warning which Guillaume mentioned from showing up.
share|improve this answer
Beautiful. That does what I want. This is just for one specific script. It is used for DR, and I want to be able to log into production servers that have been cloned to the DR environment. The IP addresses have been changed from the production IPs, but there is no guarantee that the same IPs will be used for the same servers for subsequent DR tests, so if I avoid adding them to the known_hosts file, then that helps avoid connection issues during subsequent DR tests. Thanks heaps. – Warwick Jul 4 '14 at 1:32
@Warwick, you are welcome. :) – Ramesh Jul 4 '14 at 1:34

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.