nsweeting

nsweeting

Unable to connect to SFTP server in docker container

Hi there,

I’m having an issue with connecting to an SFTP server from within a docker container on a GCP instance. Its likely a configuration issue with the image , but was just wondering if someone had some insight. I can replicate the issue within a container locally as well - but it works when I just boot up the application outside a container.

These are just pretty standard erlang 22/elixir 1.9 alpine images.

The SFTP library is here: GitHub - tlux/sftp_client: An Elixir SFTP Client that wraps Erlang's ssh and ssh_sftp. · GitHub

This is the stacktrace:

app_1       | 14:33:52.212 [info] Erlang SSH :client 4.8 (OpenSSL 1.1.1g  21 Apr 2020).
app_1       | Server: 'SSH-2.0-2.0'
app_1       | Disconnects with code = 11 [RFC4253 11.1]: Internal error
app_1       | State = {key_exchange,client,init}
app_1       | Module = ssh_connection_handler, Line = 1590.
app_1       | Details:
app_1       |   Reason: {badmatch,{error,eacces}}
app_1       | 
app_1       | 
app_1       | 14:33:52.217 [error] GenServer #PID<0.5079.0> terminating
app_1       | ** (Protocol.UndefinedError) protocol String.Chars not implemented for {{:badmatch, {:error, :eacces}}, [{:ssh_file, :default_user_dir, 1, [file: 'ssh_file.erl', line: 394]}, {:ssh_file, :file_name, 3, [file: 'ssh_file.erl', line: 222]}, {:ssh_file, :do_lookup_host_key, 4, [file: 'ssh_file.erl', line: 247]}, {:ssh_file, :is_host_key, 4, [file: 'ssh_file.erl', line: 91]}, {:ssh_transport, :known_host_key, 3, [file: 'ssh_transport.erl', line: 880]}, {:ssh_transport, :handle_kex_ecdh_reply, 2, [file: 'ssh_transport.erl', line: 698]}, {:ssh_connection_handler, :handle_event, 4, [file: 'ssh_connection_handler.erl', line: 711]}, {:gen_statem, :loop_state_callback, 11, [file: 'gen_statem.erl', line: 1161]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]} of type Tuple. This protocol is implemented for the following type(s): Decimal, NaiveDateTime, BitString, Atom, Version.Requirement, Version, URI, Date, Time, Float, List, Integer, DateTime
app_1       |     (elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
app_1       |     (elixir) lib/string/chars.ex:22: String.Chars.to_string/1
app_1       |     (sftp_client) lib/sftp_client/operation_util.ex:60: SFTPClient.OperationUtil.handle_error/1
app_1       |     (sftp_client) lib/sftp_client/operations/connect.ex:140: SFTPClient.Operations.Connect.do_connect/1
app_1       |     (sftp_client) lib/sftp_client/operations/connect.ex:49: SFTPClient.Operations.Connect.connect/1

Any help would be appreciated.

Thanks

Marked As Solved

entone

entone

I’m not familiar with that library, but I have gone down this path the erlang library that this wraps, we were using key files for auth, so I’m not exactly sure what this would be expecting if you are using a username and password.

However, checkout the options here, SFTPClient.Operations.Connect — SFTP Client v2.1.0 you may need to at least pass in a path for :user_dir that contains a .ssh directory with the proper permissions. Could just throw an empty .ssh dir in the priv directory, and point to it with :code.priv_dir(MyAppName). Just be aware of the permissions needed for the .ssh directory. If I remember, Erlang was pretty specific.

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement