PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.44k stars 762 forks source link

Permission denied, please try again. Windows 10 sshd server #2178

Closed AncientTree closed 10 months ago

AncientTree commented 1 year ago

Prerequisites

Steps to reproduce

Host & Client machine: Windows 10 22H2 19045.3570 I install Openssh last version v9.4.0.0p1-Beta by double-click .msi file. Configured as wiki guide.

Powershell report 'Permission denied, please try again' when I try to ssh local host. (debug info provided)

This PC ssh my other Windows 10 PC, succeed. my other Windows 10 PC ssh this PC with FreessHD.sshd Service, succeed too. I am confused. I have read lots of Google result and no one resolved my problem. I didn’t want to waste the experts’ time, but I really had no other choice. Hoping someone here can give me some tips.

ssh peng-office@localhost -vvv ``` PS C:\Users\Peng-Office\.ssh> ssh peng-office@localhost -vvv OpenSSH_for_Windows_9.4p1, LibreSSL 3.7.3 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/config error:2 debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2 debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\Peng-Office/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\Peng-Office/.ssh/known_hosts2' debug2: resolving "localhost" port 22 debug3: resolve_host: lookup localhost:22 debug3: ssh_connect_direct: entering debug1: Connecting to localhost [::1] port 22. debug1: Connection established. debug1: identity file C:\\Users\\Peng-Office/.ssh/id_rsa type 0 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_rsa-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519 error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519 error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519 type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519_sk type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519_sk-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_xmss error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_xmss type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_xmss-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_dsa error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_dsa type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.4 debug1: compat_banner: match: OpenSSH_for_Windows_9.4 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to localhost:22 as 'peng-office' debug3: record_hostkey: found key type ED25519 in file C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/Peng-Office/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\Peng-Office/.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 ssh-ed25519-cert-v01@openssh.com, 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,curve25519-sha256@libssh.org,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: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,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,curve25519-sha256@libssh.org,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,ecdsa-sha2-nistp256,ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com 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: chacha20-poly1305@openssh.com MAC: compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: 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:tc9iZ3etUkWL+eQSM4XygtiGyABjC8tgtOC+OnTpiVo debug3: record_hostkey: found key type ED25519 in file C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/Peng-Office/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\Peng-Office/.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 'localhost' is known and matches the ED25519 host key. debug1: Found key in C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: send packet: type 21 debug2: ssh_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: ssh_set_newkeys: mode 0 debug1: rekey in after 134217728 blocks debug3: ssh_get_authentication_socket_path: path '\\\\.\\pipe\\openssh-ssh-agent' debug2: get_agent_identities: ssh_agent_bind_hostkey: invalid format debug1: get_agent_identities: agent returned 2 keys debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_rsa RSA SHA256:Riq3MCnpTk9soDVP2bBCXe9tVbROv2nWNiLJ0WSsyAk agent debug1: Will attempt key: peng-office@DESKTOP-EGOO37A RSA SHA256:4giSmf1QxrV2EaVSIWAdX/+Cbkaz3zDvIn/P+9LbV64 agent debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ecdsa debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ed25519 debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_xmss debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_dsa 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= debug1: kex_input_ext_info: publickey-hostbound@openssh.com=<0> 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\\Peng-Office/.ssh/id_rsa RSA SHA256:Riq3MCnpTk9soDVP2bBCXe9tVbROv2nWNiLJ0WSsyAk agent 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: Offering public key: peng-office@DESKTOP-EGOO37A RSA SHA256:4giSmf1QxrV2EaVSIWAdX/+Cbkaz3zDvIn/P+9LbV64 agent 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\\Peng-Office/.ssh/id_ecdsa debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ed25519 debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ed25519: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_xmss debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_xmss: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_dsa debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_dsa: 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 peng-office@localhost's password: debug3: send packet: type 50 debug2: we sent a password packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,password,keyboard-interactive Permission denied, please try again. peng-office@localhost's password: ```
PS C:\Program Files\OpenSSH> dir ``` PS C:\Program Files\OpenSSH> dir 目录: C:\Program Files\OpenSSH Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2023/11/14 9:25 _manifest -a---- 2023/10/4 17:34 16775 FixHostFilePermissions.ps1 -a---- 2023/10/4 17:35 15953 FixUserFilePermissions.ps1 -a---- 2023/10/4 17:36 1947704 libcrypto.dll -a---- 2023/10/4 17:26 18934 LICENSE.txt -a---- 2023/10/4 17:26 587472 moduli -a---- 2023/10/4 17:26 36008 NOTICE.txt -a---- 2023/10/4 17:26 3470 openssh-events.man -a---- 2023/11/9 16:02 67 openssh.url -a---- 2023/10/4 17:34 15539 OpenSSHUtils.psd1 -a---- 2023/10/4 17:34 48686 OpenSSHUtils.psm1 -a---- 2023/10/4 17:36 436256 scp.exe -a---- 2023/10/4 17:35 384536 sftp-server.exe -a---- 2023/10/4 17:35 465328 sftp.exe -a---- 2023/10/4 17:35 614832 ssh-add.exe -a---- 2023/10/4 17:35 566192 ssh-agent.exe -a---- 2023/10/4 17:35 864704 ssh-keygen.exe -a---- 2023/10/4 17:36 676384 ssh-keyscan.exe -a---- 2023/10/4 17:36 529952 ssh-pkcs11-helper.exe -a---- 2023/10/4 17:36 189472 ssh-shellhost.exe -a---- 2023/10/4 17:35 669104 ssh-sk-helper.exe -a---- 2023/10/4 17:36 1251360 ssh.exe -a---- 2023/10/4 17:35 1343008 sshd.exe -a---- 2023/10/4 17:26 2297 sshd_config_default ```
PS C:\Users\Peng-Office\.ssh> dir ``` PS C:\Users\Peng-Office\.ssh> dir 目录: C:\Users\Peng-Office\.ssh Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 2023/11/14 9:48 2622 id_rsa -a---- 2023/11/14 9:48 582 id_rsa.pub -a---- 2023/11/14 9:31 92 known_hosts ```
PS C:\ProgramData\ssh> dir ``` PS C:\ProgramData\ssh> dir 目录: C:\ProgramData\ssh Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2023/11/14 9:25 logs -a---- 2023/11/14 10:27 582 administrators_authorized_keys -a---- 2023/11/14 10:30 7 sshd.pid -a---- 2023/11/14 10:18 2292 sshd_config -a---- 2023/11/14 9:25 513 ssh_host_ecdsa_key -a---- 2023/11/14 9:25 185 ssh_host_ecdsa_key.pub -a---- 2023/11/14 9:25 419 ssh_host_ed25519_key -a---- 2023/11/14 9:25 105 ssh_host_ed25519_key.pub -a---- 2023/11/14 9:25 2610 ssh_host_rsa_key -a---- 2023/11/14 9:25 577 ssh_host_rsa_key.pub ```
Service stat ``` PS C:\Users\Peng-Office\.ssh> Get-Service ssh* Status Name DisplayName ------ ---- ----------- Running ssh-agent OpenSSH Authentication Agent Running sshd OpenSSH SSH Server ```
sshd_config ``` # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value. #Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key #HostKey __PROGRAMDATA__/ssh/ssh_host_dsa_key HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key # Ciphers and keying #RekeyLimit default none # Logging #SyslogFacility AUTH #LogLevel INFO # Authentication: #LoginGraceTime 2m #PermitRootLogin prohibit-password #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 PubkeyAuthentication yes # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys #AuthorizedPrincipalsFile none # For this to work you will also need host keys in %programData%/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you don't trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Don't read the user's ~/.rhosts and ~/.shosts files #IgnoreRhosts yes # To disable tunneled clear text passwords, change to no here! PasswordAuthentication yes #PermitEmptyPasswords no # GSSAPI options #GSSAPIAuthentication no #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #PermitUserEnvironment no #ClientAliveInterval 0 #ClientAliveCountMax 3 #UseDNS no #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none # no default banner path #Banner none # override default of no subsystems Subsystem sftp sftp-server.exe # Example of overriding settings on a per-user basis #Match User anoncvs # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server Match Group administrators AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys ```

Expected behavior

password ssh authorized or public key ssh authorized.

Actual behavior

Permission denied, please try again. Both password and public key.

Error details

No response

Environment data

PS C:\Users\Peng-Office\.ssh> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.3570
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3570
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


### Version

v9.4.0.0p1-Beta

### Visuals

_No response_
maertendMSFT commented 12 months ago

@AncientTree what SSHD are you running on your local machine? Are you running Win32-OpenSSH or FreeSSHD?

To clarify on your scenario: you are able to connect from machine 'foo' to machine 'bar', and from 'bar' to 'foo'. You are running into issues when you are trying to connect to localhost on machine 'foo', is this correct?

Are you trying to connect as an admin on the machine? Can you provide the server-side logs? (https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps)

AncientTree commented 11 months ago

Sorry for unclear description.

@AncientTree what SSHD are you running on your local machine? Are you running Win32-OpenSSH or FreeSSHD?

I failed when use Win32-OpenSSH, while success when use FreeSSHD.

To clarify on your scenario: you are able to connect from machine 'foo' to machine 'bar', and from 'bar' to 'foo'. You are running into issues when you are trying to connect to localhost on machine 'foo', is this correct?

Machine 'bar' -> machine 'foo'(Win32-OopenSSH), failed. Machine 'foo' -> machine 'bar'(Win32-OopenSSH), success. Machine 'foo' -> machine 'foo'(Win32-OopenSSH), failed. Machine 'foo' -> machine 'foo'(FreeSSHD), success.

Are you trying to connect as an admin on the machine? Can you provide the server-side logs? (https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps)

I can't start sshd service now, the service cannot be opened in the service window that comes with Windows 10. Port 22 is free.

PS C:\WINDOWS\system32> start-Service sshd
Warning: Waiting for service "OpenSSH SSH Server (sshd)" to start...
Warning: Waiting for service "OpenSSH SSH Server (sshd)" to start...
Warning: Waiting for service "OpenSSH SSH Server (sshd)" to start...

But sshd -ddd command work well.

Service debug record (machine 'foo'(Win32-OopenSSH)): ``` PS C:\WINDOWS\system32> sshd -ddd debug2: load_server_config: filename __PROGRAMDATA__\\ssh/sshd_config debug3: w32_fstat ERROR: bad fd: 3 debug2: load_server_config: done config len = 2201 debug2: parse_server_config_depth: config __PROGRAMDATA__\\ssh/sshd_config len 2201 debug3: __PROGRAMDATA__\\ssh/sshd_config:14 setting HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key debug3: __PROGRAMDATA__\\ssh/sshd_config:16 setting HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key debug3: __PROGRAMDATA__\\ssh/sshd_config:17 setting HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key debug3: __PROGRAMDATA__\\ssh/sshd_config:34 setting PubkeyAuthentication yes debug3: __PROGRAMDATA__\\ssh/sshd_config:38 setting AuthorizedKeysFile .ssh/authorized_keys debug3: __PROGRAMDATA__\\ssh/sshd_config:51 setting PasswordAuthentication yes 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_9.4, LibreSSL 3.7.3 debug1: private host key #0: ssh-rsa SHA256:poJsYkIzFXwWGKEwNdmVlpF3BzJZOZDBWwGVdPVfKbs debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:EjEQm/aUz2aC/7tdQcuxUuzAOYBAJ2eQIpuobYJjJQw debug1: private host key #2: ssh-ed25519 SHA256:tc9iZ3etUkWL+eQSM4XygtiGyABjC8tgtOC+OnTpiVo debug1: rexec_argv[0]='C:\\Program Files\\OpenSSH\\sshd.exe' debug1: rexec_argv[1]='-ddd' debug2: fd 3 setting O_NONBLOCK debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY debug1: Bind to port 22 on ::. Server listening on :: port 22. debug2: fd 4 setting O_NONBLOCK debug1: Bind to port 22 on 0.0.0.0. Server listening on 0.0.0.0 port 22. debug3: pselect: installing signal handler for 3, previous 00007FF6B9328050 debug3: pselect: installing signal handler for 6, previous 00007FF6B9327F50 debug3: pselect: installing signal handler for 7, previous 00007FF6B9328040 debug3: pselect: installing signal handler for 8, previous 00007FF6B9328040 debug3: pselect_notify_setup: initializing debug2: fd 7 setting O_NONBLOCK debug2: fd 5 setting O_NONBLOCK debug3: pselect_notify_setup: pid 252 saved 252 pipe0 7 pipe1 5 debug3: fd 6 is not O_NONBLOCK debug1: Server will not fork when running in debugging mode. debug3: process_channel_timeouts: setting 0 timeouts debug3: channel_clear_timeouts: clearing Connection from ::1 port 64053 on ::1 port 22 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.4 debug1: compat_banner: match: OpenSSH_for_Windows_9.4 pat OpenSSH* compat 0x04000000 debug2: fd 6 setting O_NONBLOCK debug3: spawning "C:\\Program Files\\OpenSSH\\sshd.exe" -ddd -y as user debug2: Network child is on pid 14128 debug3: send_rexec_state: entering fd = 4 config len 2201 debug3: ssh_msg_send: type 0 debug3: send_rexec_state: done debug3: ssh_msg_send: type 0 debug3: ssh_msg_send: type 0 debug3: preauth child monitor started debug3: append_hostkey_type: ssh-rsa key not permitted by HostkeyAlgorithms [preauth] debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug3: send packet: type 20 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug3: receive packet: type 20 [preauth] debug1: SSH2_MSG_KEXINIT received [preauth] debug2: local server KEXINIT proposal [preauth] debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,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 [preauth] debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: compression ctos: none,zlib@openssh.com [preauth] debug2: compression stoc: none,zlib@openssh.com [preauth] debug2: languages ctos: [preauth] debug2: languages stoc: [preauth] debug2: first_kex_follows 0 [preauth] debug2: reserved 0 [preauth] debug2: peer client KEXINIT proposal [preauth] debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,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 [preauth] debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256 [preauth] debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth] debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] debug2: compression ctos: none,zlib@openssh.com,zlib [preauth] debug2: compression stoc: none,zlib@openssh.com,zlib [preauth] debug2: languages ctos: [preauth] debug2: languages stoc: [preauth] debug2: first_kex_follows 0 [preauth] debug2: reserved 0 [preauth] debug1: kex: algorithm: curve25519-sha256 [preauth] debug1: kex: host key algorithm: ssh-ed25519 [preauth] debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none [preauth] debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none [preauth] debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] debug3: receive packet: type 30 [preauth] debug1: SSH2_MSG_KEX_ECDH_INIT received [preauth] debug3: mm_sshkey_sign: entering [preauth] debug3: mm_request_send: entering, type 6 [preauth] debug3: mm_sshkey_sign: waiting for MONITOR_ANS_SIGN [preauth] debug3: mm_request_receive_expect: entering, type 7 [preauth] debug3: mm_request_receive: entering [preauth] debug3: mm_request_receive: entering debug3: monitor_read: checking request 6 debug3: mm_answer_sign: entering debug3: mm_answer_sign: ssh-ed25519 KEX signature len=83 debug3: mm_request_send: entering, type 7 debug2: monitor_read: 6 used once, disabling now debug3: send packet: type 31 [preauth] debug3: send packet: type 21 [preauth] debug2: ssh_set_newkeys: mode 1 [preauth] debug1: rekey out after 134217728 blocks [preauth] debug1: SSH2_MSG_NEWKEYS sent [preauth] debug1: Sending SSH2_MSG_EXT_INFO [preauth] debug3: send packet: type 7 [preauth] debug1: expecting SSH2_MSG_NEWKEYS [preauth] debug3: receive packet: type 21 [preauth] debug1: SSH2_MSG_NEWKEYS received [preauth] debug2: ssh_set_newkeys: mode 0 [preauth] debug1: rekey in after 134217728 blocks [preauth] debug1: KEX done [preauth] debug3: receive packet: type 5 [preauth] debug3: send packet: type 6 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method none [preauth] debug1: attempt 0 failures 0 [preauth] debug3: mm_getpwnamallow: entering [preauth] debug3: mm_request_send: entering, type 8 [preauth] debug3: mm_getpwnamallow: waiting for MONITOR_ANS_PWNAM [preauth] debug3: mm_request_receive_expect: entering, type 9 [preauth] debug3: mm_request_receive: entering [preauth] debug3: mm_request_receive: entering debug3: monitor_read: checking request 8 debug3: mm_answer_pwnamallow: entering debug2: parse_server_config_depth: config reprocess config len 2201 debug3: checking match for 'Group administrators' user peng-office host ::1 addr ::1 laddr ::1 lport 22 debug3: get_user_token - i am running as peng-office, returning process token debug1: user peng-office matched group list administrators at line 87 debug3: match found debug3: reprocess config:88 setting AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys User peng-office not allowed because shell c:\\program files\\windowsapps\\microsoft.powershell_7.2.1.0_x64__8wekyb3d8bbwe\\pwsh.exe does not exist debug3: mm_answer_pwnamallow: sending MONITOR_ANS_PWNAM: 0 debug3: mm_request_send: entering, type 9 debug2: monitor_read: 8 used once, disabling now debug3: process_channel_timeouts: setting 0 timeouts [preauth] debug3: channel_clear_timeouts: clearing [preauth] debug3: mm_inform_authserv: entering [preauth] debug3: mm_request_send: entering, type 4 [preauth] debug2: input_userauth_request: try method none [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 15.000ms, delaying 5.358ms (requested 5.090ms) [preauth] debug3: mm_request_receive: entering debug3: monitor_read: checking request 4 debug3: mm_answer_authserv: service=ssh-connection, style= debug2: monitor_read: 4 used once, disabling now debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method publickey [preauth] debug1: attempt 1 failures 0 [preauth] debug2: input_userauth_request: try method publickey [preauth] debug2: userauth_pubkey: invalid user Peng-Office querying public key rsa-sha2-512 AAAAB3NzaC1yc2EAAAADAQABAAABgQC0HAERyx/l3winJRNyb1xmjGPfFAA0zNaBY/Kd1VA9Uf0Pv0pPv7xiPQOjTGs9YFXpol4LV4bQJa3KeDJzvtWQ9gsgeqSDcJ+R3MtdbNQ/29H3oVjHlyuecssipvhGTeP+Un2QkmH9ISl1MUmN+RGcqjxZLwgLLhD9DSXJE1czTx3GbkO2dfsTHRfE17/fUlXTRO48ShjszSgAXwtb1taOpaatmlR5W51f1j3zP6KiLVN1CMJgpWI8KJ5iF+aO4iCWVfjyGt1aBIWEf2i9AtPHr45VLunInZcb+3TSEmNtjYBQnDoVazHt7knJUMhrHZTQOVU0l5euA6XTPXq+qPokFPwoH8vYYXWLlqrhgCCe9YKZeHIM1BpEjBP8G4TXJGvs20E0vJVghmAWzqR9+l8rFctlBDPSTiqPJxC6NHoDRn5u35kZz/znfkCVRnbPWG+xe15FJedZvwjsWHLaFAmZcy8VXtC9zDawlW49HUCIEjWElpn+kHd7i0BPdem9p6U= [preauth] debug1: userauth_pubkey: publickey test pkalg rsa-sha2-512 pkblob RSA SHA256:Riq3MCnpTk9soDVP2bBCXe9tVbROv2nWNiLJ0WSsyAk [preauth] debug2: userauth_pubkey: disabled because of invalid user [preauth] debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.000ms, delaying 5.090ms (requested 5.090ms) [preauth] debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method publickey [preauth] debug1: attempt 2 failures 1 [preauth] debug2: input_userauth_request: try method publickey [preauth] debug2: userauth_pubkey: invalid user Peng-Office querying public key rsa-sha2-512 AAAAB3NzaC1yc2EAAAADAQABAAABgQCoQmZw9Spf/xXRdashQpMOX00YtoJLghcGH+JjMJklohxWcvYKN8H7hl1N8fiO1/AWJm5Yc4UxrkL2EtsEg3KrvKl/moAaHeluRnXHyG2sPtAcrgwNd+Y3+OXgovXmEnL6XRz18m28hD3MGg3NlFjnU7fkSPHr5+4UNBB9v+LT5iv4VKSiTG+CG/GJIDPhnVmG6RD1f08nZZ61m7/9PrPN0lByyQzess4nhDPi0DqSd7fQgJpQ0sv8x2PVxa141mIkSf6Gy6vl+FFRSys+RrhZrkk/tGpfsnSrN3ZfrLMtevH4PvOXozD65/wkzy6IXgrWSNjeRyCOrvhnTcIFpGvj7HPih5szHBjQcDEC24ASOab9ky5nfXkJjl3PJxvmFozcLHG2/86FESqiSS6BFhj5erlronguOjo0KUA/5SvyXU5rkDxMA638Th4auMlfHWD2t6chpfCxHg5OPQkjmJJ8r1wBvyoAtpTAfCmnR6ZfvhGhoDb9AV7+QYQZM7qLpH0= [preauth] debug1: userauth_pubkey: publickey test pkalg rsa-sha2-512 pkblob RSA SHA256:4giSmf1QxrV2EaVSIWAdX/+Cbkaz3zDvIn/P+9LbV64 [preauth] debug2: userauth_pubkey: disabled because of invalid user [preauth] debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.000ms, delaying 5.090ms (requested 5.090ms) [preauth] debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method keyboard-interactive [preauth] debug1: attempt 3 failures 2 [preauth] debug2: input_userauth_request: try method keyboard-interactive [preauth] debug1: keyboard-interactive devs [preauth] debug1: auth2_challenge: user=Peng-Office devs= [preauth] debug1: kbdint_alloc: devices '' [preauth] debug2: auth2_challenge_start: devices [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.000ms, delaying 5.090ms (requested 5.090ms) [preauth] debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method password [preauth] debug1: attempt 4 failures 3 [preauth] debug2: input_userauth_request: try method password [preauth] debug3: mm_auth_password: entering [preauth] debug3: mm_request_send: entering, type 12 [preauth] debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD [preauth] debug3: mm_request_receive_expect: entering, type 13 [preauth] debug3: mm_request_receive: entering [preauth] debug3: mm_request_receive: entering debug3: monitor_read: checking request 12 debug1: Windows authentication failed for user: NOUSER domain: . error: 1326 debug3: mm_answer_authpassword: sending result 0 debug3: mm_answer_authpassword: sending result 0 debug3: mm_request_send: entering, type 13 Failed password for invalid user Peng-Office from ::1 port 64053 ssh2 debug3: mm_auth_password: user not authenticated [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.000ms, delaying 5.090ms (requested 5.090ms) [preauth] debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] debug3: receive packet: type 50 [preauth] debug1: userauth-request for user Peng-Office service ssh-connection method password [preauth] debug1: attempt 5 failures 4 [preauth] debug2: input_userauth_request: try method password [preauth] debug3: mm_auth_password: entering [preauth] debug3: mm_request_send: entering, type 12 [preauth] debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD [preauth] debug3: mm_request_receive_expect: entering, type 13 [preauth] debug3: mm_request_receive: entering [preauth] debug3: mm_request_receive: entering debug3: monitor_read: checking request 12 debug1: Windows authentication failed for user: NOUSER domain: . error: 1326 debug3: mm_answer_authpassword: sending result 0 debug3: mm_answer_authpassword: sending result 0 debug3: mm_request_send: entering, type 13 Failed password for invalid user Peng-Office from ::1 port 64053 ssh2 debug3: mm_auth_password: user not authenticated [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.000ms, delaying 5.090ms (requested 5.090ms) [preauth] debug3: userauth_finish: failure partial=0 next methods="publickey,password,keyboard-interactive" [preauth] debug3: send packet: type 51 [preauth] ```
Client ssh record(machine 'foo'(Win32-OopenSSH)): ``` PS C:\Users\Peng-Office> ssh Peng-Office@localhost -vvv OpenSSH_for_Windows_9.4p1, LibreSSL 3.7.3 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/config error:2 debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2 debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\Peng-Office/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\Peng-Office/.ssh/known_hosts2' debug2: resolving "localhost" port 22 debug3: resolve_host: lookup localhost:22 debug3: ssh_connect_direct: entering debug1: Connecting to localhost [::1] port 22. debug1: Connection established. debug1: identity file C:\\Users\\Peng-Office/.ssh/id_rsa type 0 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_rsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_rsa-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ecdsa_sk-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519 error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519 error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519 type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519_sk type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_ed25519_sk-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_ed25519_sk-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_xmss error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_xmss type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_xmss-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_xmss-cert type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_dsa error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_dsa type -1 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert error:2 debug3: Failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert.pub error:2 debug3: failed to open file:C:/Users/Peng-Office/.ssh/id_dsa-cert error:2 debug1: identity file C:\\Users\\Peng-Office/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_9.4 debug1: compat_banner: match: OpenSSH_for_Windows_9.4 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to localhost:22 as 'Peng-Office' debug3: record_hostkey: found key type ED25519 in file C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/Peng-Office/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\Peng-Office/.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 ssh-ed25519-cert-v01@openssh.com, 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,curve25519-sha256@libssh.org,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: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,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,curve25519-sha256@libssh.org,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,ecdsa-sha2-nistp256,ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com 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: chacha20-poly1305@openssh.com MAC: compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: 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:tc9iZ3etUkWL+eQSM4XygtiGyABjC8tgtOC+OnTpiVo debug3: record_hostkey: found key type ED25519 in file C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: load_hostkeys_file: loaded 1 keys from localhost debug3: Failed to open file:C:/Users/Peng-Office/.ssh/known_hosts2 error:2 debug1: load_hostkeys: fopen C:\\Users\\Peng-Office/.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 'localhost' is known and matches the ED25519 host key. debug1: Found key in C:\\Users\\Peng-Office/.ssh/known_hosts:1 debug3: send packet: type 21 debug2: ssh_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: ssh_set_newkeys: mode 0 debug1: rekey in after 134217728 blocks debug3: ssh_get_authentication_socket_path: path '\\\\.\\pipe\\openssh-ssh-agent' debug2: get_agent_identities: ssh_agent_bind_hostkey: invalid format debug1: get_agent_identities: agent returned 2 keys debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_rsa RSA SHA256:Riq3MCnpTk9soDVP2bBCXe9tVbROv2nWNiLJ0WSsyAk agent debug1: Will attempt key: peng-office@DESKTOP-EGOO37A RSA SHA256:4giSmf1QxrV2EaVSIWAdX/+Cbkaz3zDvIn/P+9LbV64 agent debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ecdsa debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ed25519 debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_xmss debug1: Will attempt key: C:\\Users\\Peng-Office/.ssh/id_dsa 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= debug1: kex_input_ext_info: publickey-hostbound@openssh.com=<0> 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\\Peng-Office/.ssh/id_rsa RSA SHA256:Riq3MCnpTk9soDVP2bBCXe9tVbROv2nWNiLJ0WSsyAk agent 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: Offering public key: peng-office@DESKTOP-EGOO37A RSA SHA256:4giSmf1QxrV2EaVSIWAdX/+Cbkaz3zDvIn/P+9LbV64 agent 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\\Peng-Office/.ssh/id_ecdsa debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ecdsa_sk: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ed25519 debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ed25519: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_ed25519_sk: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_xmss debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_xmss: No such file or directory debug1: Trying private key: C:\\Users\\Peng-Office/.ssh/id_dsa debug3: no such identity: C:\\Users\\Peng-Office/.ssh/id_dsa: 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 Peng-Office@localhost's password: debug3: send packet: type 50 debug2: we sent a password packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,password,keyboard-interactive Permission denied, please try again. Peng-Office@localhost's password: debug3: send packet: type 50 debug2: we sent a password packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,password,keyboard-interactive Permission denied, please try again. Peng-Office@localhost's password: ```
maertendMSFT commented 11 months ago

Do you have your default shell configured? There was a line that caught our attention in the SSHD debug: User peng-office not allowed because shell c:\\program files\\windowsapps\\microsoft.powershell_7.2.1.0_x64__8wekyb3d8bbwe\\pwsh.exe does not exist

Here is a link to our Wiki for default shells: https://github.com/PowerShell/Win32-OpenSSH/wiki/DefaultShell

Let us know if this changes this issue

AncientTree commented 10 months ago

Hello sir @maertendMSFT, All problems that I have met get resolve after I install the latest release v9.5.0.0p1-Beta.

Due to some unknown reasons, my sshdservice could not be started a few days ago, so I cannot tell whether changing the default shell can solve the problem I reported before. I guess I did something wrong when I first installed OpenSSH. So this issue may be close now.

Thank you for your excellent work and wish you a happy new year.