-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Public Key Authentication Issue #1245
Comments
Follow the instructions here https://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps |
Thank you. The logs are showing it is getting my publickey, but still not letting me in. I'm now getting a write failed: broken pipe error when trying to log in. I have my permissions on the .ssh folder and authorized_keys file set properly with just my account and System having access. |
Please share ssh client (.\ssh.exe -vvv user@ip) and sshd logs (DEBUG3). |
It accepts the key, but when trying to open a session, fails. |
Try this,
Are you able to login using password based authentication? Ideally it should also fail. |
Sorry for the late reply, have not been able to work on this. When running in debug mode, I am not able to get in using my public key OR my password. If I am running as a service, I am able to log in only by using my password, not key.
C:\Program Files\OpenSSH-Win64> |
I am guessing it's the problem with your authorized_keys file. debug1: trying public key file C:\Users\username.ssh/authorized_keys Verify that your authorized_keys entries looks like this, Also you can try generating new keys and using them. |
Well, I realized I was using the wrong key, changed to the correct key and it worked in interactive more, but still not working while running as a service, getting the same error as reported previously. |
Then it should be an issue with the ACLs. If it didn't solve then follow these steps,
|
Followed directions in the link, thank you. Everything came back successful, still running into the same error. as for the other troubleshooting fix you mentioned, I am trying to ssh to this box, so I don't believe step 4 would work. I enabled those two items in the config and still nothing, nothing should up in the logs folder either. |
@bagajjal Thanks for the instructions on how to activate logging. Could you please add them for future reference to this wiki page? For me this revealed the cause as
(Displaying the username rather than only the SID would be nicer.) And the permissions were in my case:
So that's just sshd, myself and two inherited standard SYSTEM and Administrators SIDs. Does that really have to count as "bad permissions"? I eventually repaired it with
resulting in
|
@bagajjal In a sense, there is a real bug here in Like @mgkuhn, my problem was the Indeed, originally that was deliberate. Now, official Windows documentation says to install OpenSSHUtils from the PowerShell Gallery, and then use the module to set correct permissions. That seems generally reasonable. Unfortunately, the most recent release of OpenSSHUtils on the PowerShell Gallery predates @manojampalam's privilege separation change. That means In conclusion, please release a new version of OpenSSHUtils to the PowerShell Gallery. Thanks. |
@iainnicol thanks for catching this. @bingbing8, @maertendMSFT please follow up. |
Please try the latest release. |
@maertendMSFT the latest release of what? Windows, OpenSSH Server, ... ? My team's been trying to use this as part of working on Codespaces and it's pretty hard to SSH to Windows with all of the out-of-date docs... feel free to ping me internally, to, if need be. Happy to try to help and make this better. |
The github release of OpenSSH for Windows is very far (nearly two years) ahead of the old v7.7 one that comes bundled with the Windows 10 distribution, which has caused regular confusion on github issues. Hopefully the one in Windows 20H1 will finally catch up in a couple of weeks time. Regarding the specific issue here: OpenSSH sshd rejects your |
Got it, thanks for writing back - will see about using the project from GitHub instead as a starting point and learn about NTFS ACLs. |
Please answer the following
If it is a terminal issue then please go through wiki
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH
"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
--7.7.2.0
Server OperatingSystem
((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)
--Windows 8.1 Enterprise
Client OperatingSystem
--CentOS 7
What is failing
--Public Key Authenticatino
Expected output
--Client able to log in via SSH
Actual output
--Permission denied. Able to authenticate via password
The text was updated successfully, but these errors were encountered: