【问题标题】:Erlang SSH daemon no hostkey algErlang SSH 守护进程没有主机密钥 alg
【发布时间】:2016-03-02 03:12:03
【问题描述】:

我正在尝试运行 otp 中为 ssh 守护程序提供的以下示例: https://raw.github.com/erlang/otp/maint/lib/ssh/examples/ssh_sample_cli.erl

1> c(ssh_sample_cli).
ssh_sample_cli.erl:146: Warning: this expression will fail with a 'badarith' exception
{ok,ssh_sample_cli}
2> ssh_sample_cli:listen(1111).
{ok,<0.51.0>}

我尝试从我的 shell 连接,但得到以下信息:

$ ssh localhost -p 1111 -oLoglevel=DEBUG
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [::1] port 1111.
debug1: Connection established.
debug1: identity file /Users/eric/.ssh/id_rsa type 1
debug1: identity file /Users/eric/.ssh/id_rsa-cert type -1
debug1: identity file /Users/eric/.ssh/id_dsa type -1
debug1: identity file /Users/eric/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version Erlang
debug1: no match: Erlang
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-sha1 none
debug1: kex: client->server aes128-cbc hmac-sha1 none
no hostkey alg
$

为什么会这样?我错过了什么?

【问题讨论】:

    标签: ssh erlang


    【解决方案1】:

    我的主机密钥必须可以从 Erlang 访问。解决方案是将我的 ssh 主机密钥复制到文件夹更改权限中,以便 Erlang 可以访问它并使用 {system_dir, "/&lt;folder&gt;/ssh/"} 选项。

    【讨论】:

    • 或者干脆在sudo下运行erl,当然不推荐,但是可以快速实验。
    【解决方案2】:

    尝试使用:

    % ssh -o 'HostKeyAlgorithms ssh-rsa,ssh-dss' ...

    【讨论】:

      【解决方案3】:

      这主要是为了我将来的参考,但是......我不小心用密码设置了我的主机密钥。 This is not recommended.

      相反,它们应该在没有密码的情况下设置。

      【讨论】:

        猜你喜欢
        • 2013-06-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-16
        • 1970-01-01
        • 2018-09-13
        • 1970-01-01
        • 2013-07-28
        相关资源
        最近更新 更多