ssh-2.0 "Key exchange failed" if known_hosts cannot be written

Daniel Goertzen daniel.goertzen@REDACTED
Thu Sep 2 21:31:38 CEST 2010


While trying to use ssh:connect(), I get {error, "Key exchange failed"}.

Tracing shows that it is trying to write to the file
"c:/Users/myname/.ssh/known_hosts".  The ".ssh" dir is not present, so the
write fails.  The error propagates up causing verify_host_key() to return
failure which kills the connection.  The host key verified properly; it just
couldn't be written to known_hosts.  I think it should return 'ok' in this
case and allow the connection to proceed.

My whole connect call was....

  {ok,Connection} = ssh:connect(Host, Port, [
    {user,Login},
    {password,Pass},
    {silently_accept_hosts, true},
    {user_interaction, false}]),

This is for a machine to machine connection, and I don't care about host key
checking anyway.  To work around this for now, I am supplying a 'user_dir'
option so it can write a known_hosts file.

Dan.


More information about the erlang-bugs mailing list