Reputation: 4338
I'm trying to connect to a sever using ssh keys, but I keep getting asked for a password. I've tried with and without the user_dir option. Does anyone have any ideas?
:ssh.start
{:ok, S} = :ssh.connect('some.host.com', 22,
[
{:silently_accept_hosts, true},
{:user_dir, '/Users/nan/.ssh'}
])
#...
:ssh.close(S)
:ssh.stop
Upvotes: 2
Views: 966
Reputation: 5558
Check the content of your ~/.ssh/config file. I believe that Erlang module is looking for id_rsa or id_dsa files directly in the directory. You might have an entry in your config file for some.host.com which defaults to different key location or different user name. Because of this, logging using command line works and it fails when the module tries to establish connection.
Also check what keys you have currently loaded in your agent session (ssh-add -L). Perhaps your are using a different key for this particular host than you suspect.
Upvotes: 2