Search code examples
ssherlangelixirelixir-iex

Unable to ssh via phoenix / Elixir


I want to ssh to a remote host via a phoenix app.

I am using Erlang :ssh following these steps

1) Starting an iex Session

iex -S mix phoenix.server

2) Ensuring that :ssh application has started

:application.ensure_all_started(:ssh)

3) ssh to remote server

{:ok, conn} = :ssh.connect('xxx.xxx.xxx.xxx', 22, [user: 'root', user_dir: 'priv/keys', silently_accept_hosts: true])

I am asked for ssh password even after following all these information.

I have the IP and the user values correctly passed also the key in priv/keys folder.

Is there something that I am doing wrong?


Solution

  • If your key file has a passphrase, you will need to include one of the *_pass_phrase options.

    {:ok, conn} = 
      :ssh.connect('xxx.xxx.xxx.xxx', 22, 
        [user: 'root', user_dir: 'priv/keys', silently_accept_hosts: true,
        rsa_pass_phrase: 'mypassphrase'])