5

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

3 Answers 3

8

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
0
11

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!

0

vi /etc/ssh/sshd_config

# To disable tunneled clear text passwords, change to no here!

#PasswordAuthentication yes

#PermitEmptyPasswords no

PasswordAuthentication yes

change yes to no

:)

You must log in to answer this question.

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