How Do I Force an SSH Client to Use a Password?

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,

host bob.specific.foo
user fred

host *.home.example
user billy
port 9191

so you could have

host server.to.test
PubkeyAuthentication no

in that file, and then simply

ssh server.to.test

and the option will get picked up.

Have questions or suggestions? @ us on Twitter and Facebook, and stay updated on new releases and articles.

November 12 2021

Add or review comments

Please leave your comment

Existing comments

Comments 0