ssh: Improve the error message for unreadable known_hosts
commitcaf7f83ee52768f1ecb7bae5dcf1316303a89be8
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2022 22:17:14 +0000 (22 22:17 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2022 22:20:39 +0000 (22 22:20 +0000)
treeb57b9ee7c87507db603cb15077fff4b0d553d5bf
parent484508146cf78abfcff4163d3aa86b81727315fe
ssh: Improve the error message for unreadable known_hosts

The new message describes several ways that the
SSH_KNOWN_HOSTS_UNKNOWN error can be produced.  After this change for
example:

  $ ./nbdkit ssh host=localhost /tmp/foo known-hosts=/nosuchfile \
             --run 'nbdinfo --size $uri'
  nbdkit: ssh[1]: error: either the host key is unknown, you must use ssh first and accept the host key; or the known_hosts file (usually ~/.ssh/known_hosts) could not be opened, check that the file exists and file permissions

Reported-by: Jonathon Jongsma
Fixes: https://gitlab.com/nbdkit/nbdkit/-/issues/10
plugins/ssh/ssh.c