【发布时间】:2020-10-10 00:14:41
【问题描述】:
由于某些原因,我们的服务器无法连接到 sftp 服务器,即使此代码在本地运行时也有效。我还可以通过运行我们的 elixir 应用程序的服务器在命令行上连接 sftp。
Elixir 版本:1.10.4-otp-23
connect("sftp.getevolved.com",
user: "User",
user_dir: "/etc/secrets/sftp",
rsa_pass_phrase: ssh_passphrase()
)
def connect(host, opts) do
opts =
Keyword.merge(
[
user_interaction: false,
silently_accept_hosts: true
],
opts
)
|> Enum.map(fn
{key, value} when is_binary(value) -> {key, value |> String.to_charlist()}
value -> value
end)
with :ok <- @ssh.start,
{:ok, channel_pid, connection} <-
@ssh_sftp.start_channel(
host |> String.to_charlist(),
22,
opts
) do
{:ok, {channel_pid, connection}}
end
end
当我尝试连接时,我收到此错误{:error, 'Key exchange failed'}。这似乎意味着存在算法问题。有没有办法对此进行更多调试,我不知道如何从连接中获取有关失败原因的更多信息。
【问题讨论】:
标签: elixir