3

When I type ssh <server> I want the default behavior to be a password prompt, except for hosts explicitly defined in my .ssh/config file for which I have created public/private key pairs.

My config file currently looks like so:

Host *
    PubkeyAuthentication no

Host <private-server>
    PubkeyAuthentication yes
    IdentityFile <private-server>_key

If I comment out the two Host * lines, then it uses my private key to connect to <private-server>. With the two Host * lines uncommented, however, it requests a password despite the PubkeyAuthentication yes line.

How do I fix this?

1 Answers1

2

From man 5 ssh_config:

Since the first obtained value for each parameter is used, more host-specific declarations should be given near the beginning of the file, and general defaults at the end.

Your Host * section is most general. It should be at the very end.