SSH – How to Make SSH Ignore .ssh/config

ssh

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?

Best Answer

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.
Related Question