我可以确定主机服务器上我的公钥的哪些信息?

zun*_*arz 2 ssh sftp key-authentication

sftp.foobar.com的管理员已执行以下操作:

  1. 已确认收到我的公钥。(id_rsa.pub)
  2. 给我他们服务器的主机名(sftp.foobar.com)
  3. 给我一个 ssh/sftp 连接的用户 ID (foo_user1)

这是我的.ssh/config 条目

Host foobar
 
 identityfile  id_rsa
 hostname      sftp.foobar.com
 user          foo_user1
 port          22 # I've also tried 2222 

$sftp -vvv foobar


 OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /home/foo_client/.ssh/config
debug1: /home/foo_client/.ssh/config line 332: Applying options for foobar
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "sftp.foobar.com" port 2222
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to sftp.foobar.com [21.01.148.55] port 2222.

  #The session hangs and I CTRL-C to terminate command.


  $ssh 21.01.148.55

# I get no response
# I get neither userid nor password prompt.
Run Code Online (Sandbox Code Playgroud)

问题:关于主机服务器上的公钥,我可以得出什么结论?

我是否有足够的信息来断定 foobar 管理员尚未安装我的公钥?

如果他们已安装公钥但已损坏,我是否可以从 -vvv 输出中获取更多信息?

Gil*_*il' 8

您无法确定有关公钥的任何信息。您的连接被防火墙阻止。

\n

SSH 的调试输出不会帮助您诊断防火墙问题:它们发生在 TCP 以下的级别。这可能是您的计算机、本地网络、(不太可能)介于两者之间、服务器的本地网络或服务器本身的问题。tcptraceroute可能有帮助。

\n

以下是一些示例输出,其中包含您在成功连接时会看到的一些相关消息:

\n
\xe2\x80\xa6\ndebug1: Connecting to sftp.foobar.com [21.01.148.55] port 2222.\ndebug1: Connection established.\ndebug1: identity file /home/foo_client/.ssh/id_rsa type -1\n\xe2\x80\xa6\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.4\n\xe2\x80\xa6\ndebug1: Will attempt key: /home/from_client/.ssh/id_rsa \n\xe2\x80\xa6\ndebug1: Next authentication method: publickey\n\xe2\x80\xa6\ndebug1: Offering public key: \xe2\x80\xa6\n\xe2\x80\xa6\nAuthenticated to sftp.foobar.com (21.01.148.55:2222) using "publickey".\n\xe2\x80\xa6\n
Run Code Online (Sandbox Code Playgroud)\n

(我稍微编辑了这些消息,可能得到了主机名的确切格式等错误。)

\n

值得注意的是:

\n
    \n
  • debug1: Connecting是客户端启动 TCP 连接的时间。
  • \n
  • debug1: Connection established.表示TCP连接已建立。您的连接未能到达此点。
  • \n
  • debug1: Remote protocol version \xe2\x80\xa6是服务器已使用 SSH 协议进行回复的第一个指示。
  • \n
  • debug1: Will attempt key:表示您的客户端找到的密钥。
  • \n
  • debug1: Next authentication method: publickey表示在与服务器协商后,您的客户端决定尝试公钥身份验证。
  • \n
  • debug1: Offering public key: \xe2\x80\xa6表示您的客户端现在正在尝试使用此密钥进行身份验证。
  • \n
  • Authenticated to sftp.foobar.com (21.01.148.55:2222) using "publickey".表示服务器已接受最后提供的密钥。
  • \n
\n

  • @zundarz 请询问那些拒绝您使用可以分析此问题的工具的人,以便为您分析和修复它。如果您的 IT 部门阻止与您应该连接的服务器的连接,他们需要更改防火墙规则。 (5认同)