1

I'm sshing into a remote host and it's picking gssapi-with-mic authentication. How do I set at command line to only use public key? I don't have access to the remote server's /etc/ssh/sshd_config and it seems all the recommendation is for changing the config rather than command line option.

1

2 Answers 2

4

That should be with:

ssh -o PreferredAuthentications=publickey host

The default value of PreferredAuthentications according to the manual is: gssapi-with-mic,hostbased,publickey,keyboard-interactive,password.

0

You can try something like:

ssh -o " AllowedAuthentication=publickey" -i path/to/private_key username@hostname

For the record your private key is located (usually) in ~/.ssh directory

1
  • 1
    From the manual, I'm not convinced it would cause publickey auth to take precedence over gssapi-with-mic. It would rather bypass the authentication agent. Sep 26, 2021 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .