I have the following in my ~/.ssh/config.

HOST 10.2.192.*
        USER foo
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/foo/id_rsa

The above configuration lets me connect to a machine while typing half as many words.

 ssh 10.2.192.x

Before my ssh config, I had to type in all of this:

 ssh foo@10.2.192.x -i ~/.ss/foo/id_rsa

However there is one machine in the 10.2.192.x subnet that I want to connect to with password based authentication instead of keybased authentication.

Because ssh looks at my config file and finds a match for PreferredAuthentications publickey I am unable to login with just my password.

I don't intend to ssh into this special snowflake vm often enough to warrant adding a new rule to my ssh config.

How can I make ssh ignore my config file just this once, and allow me to authenticate with a password?

2 Answers 2


To make your ssh client ignore your configuration file, use ssh -F /dev/null username@example.com. Because your subnet's IdentityFile is in ~/.ssh/foo rather than ~/.ssh/, you don't need to whip up a whole new file to eschew your extant private key.

From the ssh man page:

 -F configfile
     Specifies an alternative per-user configuration file.  If a
     configuration file is given on the command line, the system-wide
     configuration file (/etc/ssh/ssh_config) will be ignored. The default 
     for the per-user configuration file is ~/.ssh/config.

I believe that this question is already answered by: How to force ssh client to use only password auth?

ssh -o PubkeyAuthentication=no example.com
  • 4
    Ah, but the actual question (notwithstanding its title), after all the preamble, was: "How can I make ssh ignore my config file just this once, and allow me to authenticate with a password?"
    – DopeGhoti
    Jan 21, 2014 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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