无法从办公室 ssh 到家里的 Mac

无法从办公室 ssh 到家里的 Mac

我正尝试从办公室通过 ssh/sftp 连接到家里的 Mac。

我可以 ping 通它。我很确定我正确设置了密钥ssh-keygen

以下是我得到的信息(用 屏蔽的私人信息•••):

Edit07:.ssh zeev$ ssh -vvv dzg@•••.dyndns.tv
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to •••.dyndns.tv [76.•••.62] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /Users/zeev/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /Users/zeev/.ssh/id_rsa type 1
debug1: identity file /Users/zeev/.ssh/id_rsa-cert type -1
debug3: Not a RSA1 key file /Users/zeev/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /Users/zeev/.ssh/id_dsa type 2
debug1: identity file /Users/zeev/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote host

答案1

看起来您使用了错误版本的 SSH 密钥。

假设您在工作时运行的是 Mac OS X(或任何其他 UNIX/Linux 变体),请运行以下命令:ssh-keygen -t rsa并指定~/.ssh/home为您的路径 - 这将允许您id_rsa在需要时将默认密钥用于工作目的。然后:cat ~/.ssh/home.pub并将密钥粘贴到~/.ssh/authorized_keys您家用 Mac 上的文件中。

如果您运行的是 Windows,请使用 PuTTYgen 重新生成密钥,但这次将“OpenSSH”公钥(位于顶部的可滚动窗口中)复制到~/.ssh/authorized_keys家用 Mac 上的文件中。然后将密钥的 PPK 版本加载到 PuTTY 的代理中。

相关内容