How to stop SSH from falling back to password?
5,390
Solution 1
If you don't want to globally disable password authentication on your server you can use the -o "PasswordAuthentication no"
option on the ssh command line e.g.
ssh -o "PasswordAuthentication no" YourHost
Solution 2
You can stop password authentication by configuring the ssh daemon. Edit the /etc/ssh/sshd_config
file.
#PasswordAuthentication yes
Uncomment and change the above line to "no"
.
PasswordAuthentication no
Don't forget to restart your ssh daemon!
Related videos on Youtube
Author by
wodow
Updated on September 17, 2022Comments
-
wodow almost 2 years
A script regularly initiates an SSH connection from one server to another, using SSH keys.
However, once, the keys were briefly overwritten. This caused the SSH client to fall back to asking for a password, which had undesired knock-on effects.
Is it possible to instruct SSH to exit if key-based auth fails, and not fall back to asking for a password?
Thanks!
Wodow