SSH:与 IP 的连接已关闭

SSH:与 IP 的连接已关闭

我正在尝试通过 SSH 连接到我的计算机:从 Powershell,我使用 ssh user@public_ip,然后输入密码。我收到以下响应:

Impossibile accedere al file.
Connection to public_ip closed.

如果是 ssh user@public_ip -v

Impossibile accedere al file.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to public_ip closed.
Transferred: sent 2596, received 2748 bytes, in 0.1 seconds
Bytes per second: sent 21839.0, received 23117.7
debug1: Exit status 0

使用 ssh 用户@public_ip -vvv

(base) PS C:\Users\plini> ssh plini@public_ip -vvv
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Reading configuration data C:\\Users\\plini/.ssh/config
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname public_ip is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\plini/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\plini/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to public_ip [public_ip] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\plini/.ssh/id_rsa type 0
debug3: Failed to open file:C:/Users/plini/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_rsa-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_rsa-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_rsa-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_dsa error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_dsa.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_dsa error:2
debug1: identity file C:\\Users\\plini/.ssh/id_dsa type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_dsa-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_dsa-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_dsa-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_dsa-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ecdsa error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ecdsa type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ecdsa-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ecdsa-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ecdsa_sk type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ecdsa_sk-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ecdsa_sk-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519 error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ed25519 error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ed25519-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ed25519-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519_sk error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519_sk.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ed25519_sk error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ed25519_sk type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519_sk-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_ed25519_sk-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_ed25519_sk-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_ed25519_sk-cert type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_xmss error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_xmss.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_xmss error:2
debug1: identity file C:\\Users\\plini/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/plini/.ssh/id_xmss-cert error:2
debug3: Failed to open file:C:/Users/plini/.ssh/id_xmss-cert.pub error:2
debug3: failed to open file:C:/Users/plini/.ssh/id_xmss-cert error:2
debug1: identity file C:\\Users\\plini/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.6
debug1: compat_banner: match: OpenSSH_for_Windows_8.6 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to public_ip:22 as 'plini'
debug3: record_hostkey: found key type ED25519 in file C:\\Users\\plini/.ssh/known_hosts:9
debug3: load_hostkeys_file: loaded 1 keys from public_ip
debug3: Failed to open file:C:/Users/plini/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\plini/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: have matching best-preference key type [email protected], using HostkeyAlgorithms verbatim
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:JN3275G/jvjjXbUWN7CbfGiw6OZBDAsMF1YG3bsnefs
debug3: record_hostkey: found key type ED25519 in file C:\\Users\\plini/.ssh/known_hosts:9
debug3: load_hostkeys_file: loaded 1 keys from public_ip
debug3: Failed to open file:C:/Users/plini/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\plini/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'public_ip' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\plini/.ssh/known_hosts:9
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_rsa RSA SHA256:wQeL1RjSVhzcAjDtFE5eeyKApH9k5XwMlRn4ODky5a4
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\plini/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\plini/.ssh/id_rsa RSA SHA256:wQeL1RjSVhzcAjDtFE5eeyKApH9k5XwMlRn4ODky5a4
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\\Users\\plini/.ssh/id_dsa
debug3: no such identity: C:\\Users\\plini/.ssh/id_dsa: No such file or directory
debug1: Trying private key: C:\\Users\\plini/.ssh/id_ecdsa
debug3: no such identity: C:\\Users\\plini/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: C:\\Users\\plini/.ssh/id_ecdsa_sk
debug3: no such identity: C:\\Users\\plini/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: C:\\Users\\plini/.ssh/id_ed25519
debug3: no such identity: C:\\Users\\plini/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: C:\\Users\\plini/.ssh/id_ed25519_sk
debug3: no such identity: C:\\Users\\plini/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: C:\\Users\\plini/.ssh/id_xmss
debug3: no such identity: C:\\Users\\plini/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
[email protected]'s password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to public_ip ([public_ip]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: filesystem full
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug3: This windows OS supports conpty
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug3: Successfully set console output code page from:65001 to 65001
debug3: Successfully set console input code page from:850 to 65001
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: client_input_hostkeys: received RSA key SHA256:b79wuqANhPamHoG5KWdtoCbG9tBam6WXFYi5eJSXKbo
debug3: client_input_hostkeys: received ECDSA key SHA256:ukaGOxNo0UqCAulxduzXLrbfg2DaCZTp4UyW0mjf10A
debug3: client_input_hostkeys: received ED25519 key SHA256:JN3275G/jvjjXbUWN7CbfGiw6OZBDAsMF1YG3bsnefs
debug1: client_input_hostkeys: searching C:\\Users\\plini/.ssh/known_hosts for public_ip / (none)
debug3: hostkeys_foreach: reading file "C:\\Users\\plini/.ssh/known_hosts"
debug3: hostkeys_find: found ssh-ed25519 key under different name/addr at C:\\Users\\plini/.ssh/known_hosts:6
debug3: hostkeys_find: found ssh-rsa key under different name/addr at C:\\Users\\plini/.ssh/known_hosts:7
debug3: hostkeys_find: found ecdsa-sha2-nistp256 key under different name/addr at C:\\Users\\plini/.ssh/known_hosts:8
debug3: hostkeys_find: found ssh-ed25519 key at C:\\Users\\plini/.ssh/known_hosts:9
debug3: hostkeys_find: found ssh-ed25519 key under different name/addr at C:\\Users\\plini/.ssh/known_hosts:10
debug1: client_input_hostkeys: searching C:\\Users\\plini/.ssh/known_hosts2 for public_ip / (none)
debug3: Failed to open file:C:/Users/plini/.ssh/known_hosts2 error:2
debug1: client_input_hostkeys: hostkeys file C:\\Users\\plini/.ssh/known_hosts2 does not exist
debug3: client_input_hostkeys: 3 server keys: 2 new, 18446744073709551615 retained, 2 incomplete match. 0 to remove
debug1: client_input_hostkeys: host key found matching a different name/address, skipping UserKnownHostsFile update
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Impossibile accedere al file.
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 5 efd 6 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug3: Successfully set console output code page from 65001 to 65001
debug3: Successfully set console input code page from 65001 to 850
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1)

debug3: send packet: type 1
Connection to public_ip closed.
Transferred: sent 2596, received 2748 bytes, in 0.1 seconds
Bytes per second: sent 18037.4, received 19093.5
debug1: Exit status 0

运行 sshd.exe -D -ddd -p 2222,我有

debug2: load_server_config: filename __PROGRAMDATA__\\ssh/sshd_config
debug3: w32_fstat ERROR: bad fd: 3
debug2: load_server_config: done config len = 256
debug2: parse_server_config_depth: config __PROGRAMDATA__\\ssh/sshd_config len 256
debug3: __PROGRAMDATA__\\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys
debug3: __PROGRAMDATA__\\ssh/sshd_config:79 setting Subsystem sftp      sftp-server.exe
debug3: checking syntax for 'Match Group administrators'
debug1: sshd version OpenSSH_for_Windows_8.6, LibreSSL 3.4.3
debug1: get_passwd: lookup_sid() failed: 1332.
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_rsa_key error:5
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_rsa_key error:13
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_rsa_key.pub error:13
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_rsa_key error:5
debug1: Unable to load host key: __PROGRAMDATA__\\ssh/ssh_host_rsa_key
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_ecdsa_key error:5
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_ecdsa_key error:13
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_ecdsa_key.pub error:13
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_ecdsa_key error:5
debug1: Unable to load host key: __PROGRAMDATA__\\ssh/ssh_host_ecdsa_key
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_ed25519_key error:5
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_ed25519_key error:13
debug3: Failed to open file:C:/ProgramData/ssh/ssh_host_ed25519_key.pub error:13
debug3: failed to open file:C:/ProgramData/ssh/ssh_host_ed25519_key error:5
debug1: Unable to load host key: __PROGRAMDATA__\\ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.

这可能与我的 sshd_config 文件有关吗?

该服务正在运行,实际上通过运行 (Get-Service -Name sshd)。状态为正在运行。我甚至完全禁用了 Windows 防火墙。

对于这种行为背后可能存在什么原因,有什么建议吗?

答案1

由于它要求输入密码,并且您正在获取客户端会话,因此这不是 IP 问题。您的客户端连接到服务器,并且它们进行协商,因此您有一个 TCP 连接。

您的密码很可能也是正确的(否则您通常有三次机会来回答)。

很可能是服务器在启动会话时出现了问题。

但是,您可以在前台(在 Windows 命令提示符中)运行 sshd,如下所示

sshd.exe -D -ddd -p 2222

或者根据环境,你可能需要

sshd.exe -D -f <path-to-sshd_config> -h <path-to-hostkey> -ddd -p 2222

可能

sshd.exe -D -f C:\programdata\ssh\sshd_config  -h C:\programdata\ssh\ssh_host_rsa_key -ddd -p 2222

这将为您提供一个运行并监听端口 2222 的服务器。

您可以通过该服务器连接ssh user@host -p 2222并检查在服务器窗口中获得的输出。

或者参考主题在 Windows 中启动 OpenSSH 服务器并启用调试消息(-d)有关如何调试/记录 Windows sshd。

相关内容