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
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









