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.
Asked
Active
Viewed 954 times
2 Answers
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.
Stéphane Chazelas
- 522,931
- 91
- 1,010
- 1,501
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
Romeo Ninov
- 16,541
- 5
- 32
- 44
-
1From 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. – Stéphane Chazelas Sep 26 '21 at 11:50