"Permission denied (publickey,password,keyboard-interactive)."
"OpenSSH for Windows" version
7.7.2.1
Server OperatingSystem
Windows Server 2019 Datacenter
Client OperatingSystem
Windows 10 Pro
What is failing
I can connect to the Windows Server 2019 (domain joined)
- [ ] from Windows 10 client via Internet
ssh -v username@ipDOES NOT WORK - [x] from Windows 10 using WinSCP.exe WORKS
- [x] from Ubuntu WSL
ssh jsw@fqdnWORKS - [x] locally in the server
ssh username@localhostWORKS - [x] from Ubuntu
ssh jsw@fqdnWORKS
Expected output Successful login
Actual output
username@ip: Permission denied (publickey,password,keyboard-interactive).
The only client that fails is the ssh.exe from Windows 10. Can anyone help me find out why? Here's the ssh log:
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\yooak/.ssh/config
debug1: C:\\Users\\yooak/.ssh/config line 1: Applying options for *
debug1: Connecting to 40.118.103.34 [40.118.103.34] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\yooak/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\yooak/.ssh/id_ed25519 type 3
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\yooak/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_7.7
debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 40.118.103.34:22 as 'june'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:yPNwoYDrXFsygNKZjuFjbOcpiV6UkXkq6KFeNCyJ7lg
debug1: Host '40.118.103.34' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\yooak/.ssh/known_hosts:38
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:S3gDtopWHfXlLhUNWCc89/x4eXOXIZVsNd3rgtyLHk4 C:\\Users\\yooak/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: ED25519 SHA256:ZyLjH5uIMN14F/QkeOA2yFMM3J9CY87ytOybLQ2YbLw C:\\Users\\yooak/.ssh/id_ed25519
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\\Users\\yooak/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\yooak/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\yooak/.ssh/id_xmss
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,password,keyboard-interactive).
Please share server side logs. See https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps
Did you expect one of the public keys to work ? If you have give too many invalid key identities for the client to try (ex. you have a bunch of keys registered with ssh-agent that aren't valid for the target you are connecting to), you'll see that the server will reject the connection after 3 failed authentication attempts. This is by design
Please share server side logs. See https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps
Did you expect one of the public keys to work ? If you have give too many invalid key identities for the client to try (ex. you have a bunch of keys registered with ssh-agent that aren't valid for the target you are connecting to), you'll see that the server will reject the connection after 3 failed authentication attempts. This is by design
I have two keys so the number of keys is likely not the issue. The strange thing, I think, is that it works fine from other SSH clients (WinSCP, ssh in WSL etc) but not the Windows ssh client.
Same here! see this issue that I have been created. https://github.com/PowerShell/Win32-OpenSSH/issues/1369
I have a solution : the sshd_config :
#LoginGraceTime 2m #PermitRootLogin prohibit-password StrictModes no #MaxAuthTries 6 #MaxSessions 10
the StrictModes set the value no and uncoment the # finally you can ssh the windows server
I have a solution : the sshd_config :
#LoginGraceTime 2m #PermitRootLogin prohibit-password StrictModes no #MaxAuthTries 6 #MaxSessions 10
the StrictModes set the value no and uncoment the # finally you can ssh the windows server
It's work for me. Thanks!
Can you please share your client and server side logs? See manojampalam's comment above.
From https://github.com/PowerShell/Win32-OpenSSH/wiki/Security-protection-of-various-files-in-Win32-OpenSSH#administrators_authorized_keys:
PS C:\>icacls administrators_authorized_keys /inheritance:r
PS C:\>icacls administrators_authorized_keys /grant SYSTEM:`(F`)
PS C:\>icacls administrators_authorized_keys /grant BUILTIN\Administrators:`(F`)
Closing this issue as it's expected for admin users to store the public keys in $env:programdata\ss\administrators_authorized_keys file. This file should have right permissions.
What are the right permissions for this file?
What are the right permissions for this file?
https://github.com/PowerShell/Win32-OpenSSH/wiki/Security-protection-of-various-files-in-Win32-OpenSSH#administrators_authorized_keys
and https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement on using the Powershell utility to achieve the same.
I have a solution : the sshd_config :
#LoginGraceTime 2m #PermitRootLogin prohibit-password StrictModes no #MaxAuthTries 6 #MaxSessions 10
the StrictModes set the value no and uncoment the # finally you can ssh the windows server
大佬!!!牛逼!!!
时间过期不接受。
Still facing same issue, none of the guides helped me.
@orihomie - Please create a new issue. You get permission denied in so many ways. Don't forget to attach the ssh client logs (ssh -vvv user@ip) and the ssh server logs
I have a solution : the sshd_config :
#LoginGraceTime 2m #PermitRootLogin prohibit-password StrictModes no #MaxAuthTries 6 #MaxSessions 10
the StrictModes set the value no and uncoment the # finally you can ssh the windows server
Thankyou! I love you ❤️😁
时间过期不接受。
"OpenSSH for Windows" version
7.7.2.1Server OperatingSystem
Windows Server 2019 DatacenterClient OperatingSystem
Windows 10 ProWhat is failing
I can connect to the Windows Server 2019 (domain joined)
- [ ] from Windows 10 client via Internet
ssh -v username@ipDOES NOT WORK- [x] from Windows 10 using WinSCP.exe WORKS
- [x] from Ubuntu WSL
ssh jsw@fqdnWORKS- [x] locally in the server
ssh username@localhostWORKS- [x] from Ubuntu
ssh jsw@fqdnWORKSExpected output Successful login
Actual output
username@ip: Permission denied (publickey,password,keyboard-interactive).The only client that fails is the ssh.exe from Windows 10. Can anyone help me find out why? Here's the ssh log:
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug1: Reading configuration data C:\\Users\\yooak/.ssh/config debug1: C:\\Users\\yooak/.ssh/config line 1: Applying options for * debug1: Connecting to 40.118.103.34 [40.118.103.34] port 22. debug1: Connection established. debug1: identity file C:\\Users\\yooak/.ssh/id_rsa type 0 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_ecdsa-cert type -1 debug1: identity file C:\\Users\\yooak/.ssh/id_ed25519 type 3 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_ed25519-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_xmss type -1 debug1: key_load_public: No such file or directory debug1: identity file C:\\Users\\yooak/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7 debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_7.7 debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 40.118.103.34:22 as 'june' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:yPNwoYDrXFsygNKZjuFjbOcpiV6UkXkq6KFeNCyJ7lg debug1: Host '40.118.103.34' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\yooak/.ssh/known_hosts:38 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey after 134217728 blocks debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering public key: RSA SHA256:S3gDtopWHfXlLhUNWCc89/x4eXOXIZVsNd3rgtyLHk4 C:\\Users\\yooak/.ssh/id_rsa debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Offering public key: ED25519 SHA256:ZyLjH5uIMN14F/QkeOA2yFMM3J9CY87ytOybLQ2YbLw C:\\Users\\yooak/.ssh/id_ed25519 debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Trying private key: C:\\Users\\yooak/.ssh/id_dsa debug1: Trying private key: C:\\Users\\yooak/.ssh/id_ecdsa debug1: Trying private key: C:\\Users\\yooak/.ssh/id_xmss debug1: No more authentication methods to try. [email protected]: Permission denied (publickey,password,keyboard-interactive).
Just comment these two lines, thank me later
file source: C:\ProgramData\ssh\sshd_config
#Match Group administrators
# AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
时间过期不接受。
Solved, I did the following : 1- Edited the sshd_config file as follows: PasswordAuthentication yes 2- Restarted the "OpenSSH SSH Server" Service
and it worked fine
时间过期不接受。