How to force ssh client to use only password auth?

I recently needed this too, and came up with this:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no

You need to make sure that the client isn't configured to disallow password authentication.

I've discovered a shortcut for this purpose:


Note the colon (:) and the empty password after it.

As well as the method posted by scoopr, you can set per host options in your ssh client configuration file.

In your .ssh directory, create a file called config (if it doesn't already exist) and set the permissions to 600, you can then create sections which start with

host <some hostname or pattern>

and then set per host options after that, for example,

user fred

host *.home.example
user billy
port 9191

so you could have

PubkeyAuthentication no

in that file, and then simply


and the option will get picked up.