65

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 [email protected] -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

84

To make your ssh client ignore your configuration file, use ssh -F /dev/null [email protected]. 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.
25

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
1
  • 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?" Commented Jan 21, 2014 at 19:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.