我在新安装的 Windows 11 上运行 sshd 时遇到问题。Get-service 显示 sshd 和 ssh-agent 都在运行。Defender 防火墙已关闭。我使用以下命令生成密钥:ssh-keygen -t rsa -b 4096。
错误是:
kex_exchange_identification:远程主机关闭连接 127.0.0.1 端口 22 关闭连接
如果 ssh 到 localhost 失败,是不是有什么严重问题? -vvv 输出如下。
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug3: Failed to open file:C:/Users/jeff/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 127.0.0.1 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\jeff/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\jeff/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\jeff/.ssh/id_rsa type 0
debug3: Failed to open file:C:/Users/jeff/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_rsa-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_rsa-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_rsa-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_dsa error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_dsa.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_dsa error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_dsa type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_dsa-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_dsa-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_dsa-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_dsa-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ecdsa error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ecdsa type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ecdsa-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ecdsa-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ecdsa_sk type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ecdsa_sk-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ecdsa_sk-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519 error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ed25519 error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ed25519-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ed25519-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ed25519_sk type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_ed25519_sk-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_ed25519_sk-cert type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_xmss error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_xmss.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_xmss error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/jeff/.ssh/id_xmss-cert error:2
debug3: Failed to open file:C:/Users/jeff/.ssh/id_xmss-cert.pub error:2
debug3: failed to open file:C:/Users/jeff/.ssh/id_xmss-cert error:2
debug1: identity file C:\\Users\\jeff/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
kex_exchange_identification: Connection closed by remote host
Connection closed by 127.0.0.1 port 22