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
You can stop password authentication by configuring the ssh daemon. Edit the
/etc/ssh/sshd_config
file.Uncomment and change the above line to
"no"
.Don't forget to restart your ssh daemon!
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.vi /etc/ssh/sshd_config
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
change
yes
tono
:)