ssh: Improve the error message when all authentication methods fail
commitbea88cff5ac9c42f1a068ad24d43d5ed0506edaa
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 5 Jan 2023 11:29:32 +0000 (5 11:29 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 6 Jan 2023 08:53:57 +0000 (6 08:53 +0000)
treee6baccd7b9b628de4c1717741ad2e9ff3b06468d
parentc93a8957efcc26652b31f5bc359dfd3c4019b4f8
ssh: Improve the error message when all authentication methods fail

The current error message:

  nbdkit: ssh[1]: error: all possible authentication methods failed

is confusing and non-actionable.  It's hard even for experts to
understand the relationship between the authentication methods offered
by a server and what we require.

Try to improve the error message in some common situations, especially
where password authentication on the server side is disabled but the
client supplied a password=... parameter.  After this change, you will
see an actionable error:

  nbdkit: ssh[1]: error: the server does not offer password
  authentication but you tried to use a password; if you have root
  access to the server, try editing 'sshd_config' and setting
  'PasswordAuthentication yes'; otherwise try setting up public key
  authentication

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2158300
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
plugins/ssh/ssh.c