-
Notifications
You must be signed in to change notification settings - Fork 781
Error retrieving user environment variables. RegOpenKeyExW returned 5 #645
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
Comments
Can you share ssh-agent logs? See wiki for trouble shooting steps. |
ssh-agent.log file is empty I used the wiki to perform the install, with one exception, after installing the ssh-lsa, I didn't reboot - hard to get outages, is there any way to avoid a reboot? This looked like a simple dll registration, but I'm a unix admin, havent really played on windows for a decade. When I run regsvr32 c:\windows\system32\ssh-lsa.dll I get I'm guessing that that reboot is something I cant avoid. if so, thanks for your help. I'll close the comment. |
If you need key based authentication to work with workgroup (non-domain) accounts, it is necessary to run install-sshlsa.ps1 and reboot the machine. This unfortunately is a limitation of Windows security subsystem. That said, I am working on alternative solution that might not need a machine reboot, but its not ready yet. |
I'm seeing this error message in my logs too, but I'm not sure if it is the reason why my logins don't always work (however I'm not writing about that here). I looked up Microsoft's documentation for the routine
This would appear to be the fix necessary, since session.c line 336 is doing exactly that which the documentation says not to do. The return value 5 that we're seeing is |
To confirm: The error message which is the subject of this issue gets logged (4 times per login) even when I successfully login to a local account using a public key that is present in the authorized_keys file. |
Windows 2008 R2 7601 SP1 Issues:
Ran PS commands to get most recent packages. Followed installation instructions from: Unable to run "powershell -executionpolicy bypass -file install-sshlsa.ps1" as these errors appear. ===============================================================
Method invocation failed because [Microsoft.Win32.RegistryKey] doesn't contain a method named 'OpenBaseKey'.
You cannot call a method on a null-valued expression.
You cannot call a method on a null-valued expression.
You cannot call a method on a null-valued expression.
Value for HKLM\System\CurrentControlSet\Control\LSA\Authentication Packages = "msv1_0" sshd.log on sshd start ============================================================== #6324 18:22:10 553 Server listening on :: port 22. =============================================================== additional logs on attempt to connect: =============================================================== #4896 18:24:30 730 error: Couldn't create pid file "./sshd.pid": Permission denied ================================================================= Nothing in ssh-agent.log before or after connection attempts. Apologize for any "Funky" Markdowns... |
Now version 0.0.12.0, there's no ssh-lsa.dll, but still "Error retrieving user environment variables. RegOpenKeyExW returned 5" error. Do I have to reboot? |
while establishing the session, sshd process will try to retrieve the environment information from the windows registry.. are you seeing this in the sshd.log file? |
Yes, in a seesion (sorry the error number is 234 instead of 5)
when creating a session, it shows these logs in sshd.log, while the ssh-agent.log is empty. It does not block establishing the sessions, but I could not get correct PATH for the user. |
For the below error, Try changing the sshd_config as mentioned in this issue #493. |
Do you think it cannot get correct PATH since it could not create pid file? According to error code, it refers to
Anyway, I'll try fix the pid issue first. |
I investigated the code you sent, 256 is the length of name which has no problem. |
From: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724865(v=vs.85).aspx
First time calling this, data is NULL, so it succeed. The next time found that the buffer is not enough, it would return ERROR_MORE_DATA and never goes to the code path to extend |
This for the data (lpData) not for the name (lpValueName).. The code shown is for the lpValueName |
Could you help review the pull request? |
Note that the subject line of this particular github issue is about a different error return value and from a different function than that pull request is fixing... |
Thanks @clouds56. Merged your PR. |
@anjohnson is right... this issue is different from the PATH error fixed in #696 Here is my log from v0.0.12.0:
I've got password & key authentication working, but this appears to be agent permission issues still. |
@mabrowning Thanks for confirming this is still happening in a newer version. Whenever I login to my system that has this installed I get these log entries added to the sshd.log file:
I already pointed out where the error message comes from, quoting Microsoft's own documentation, which even explains how to fix it. However @bingbing8 doesn't seem to care that the bug hasn't actually been fixed, just that the Github issue has been disposed of. |
@anjohnson Am I understanding you correctly that you are successfully logging in, even with this error? All of my connections are getting 'socket closed' on the client side. Perhaps that is yet a different problem.. |
@mabrowning yes, my logins do succeed, so I doubt that the RegOpenKeyExW error is the cause of your problem. I think I'm running an older version than you are though (v0.0.10 IIRC) and in fact I have given up trying to use this software for my purposes until some other bugs get fixed — the stdin/stdout channels don't transport binary data properly, so I went back to the Cygwin sshd for now. |
My log file:
|
@neoblackxt see if #690 helps. (assign needed privileges to sshd) |
Reopening this issue to track "RegOpenKeyExW returned 5". This is fixed as part of #726 |
Please answer the following
Windows 2008 R2 7601 SP1
sshd 0.0.10.0
When attempting to use rsa key authentication, the following error occurs:
2012 11:23:11 430 error: Error retrieving user environment variables. RegOpenKeyExW returned 5
passwordless login.
From windows / putty with agent and imported key
Authenticating with public key "imported-openssh-key" from agent Server refused public-key signature despite accepting key!
From Bash for windows with agent running and key loaded
debug1: Host '10.0.0.50' is known and matches the ECDSA host key. debug1: Found key in /home/testuser/.ssh/known_hosts:2 debug1: ssh_ecdsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/testuser/.ssh/id_rsa (0x7fffd79e2d50), debug2: key: /home/testuser/.ssh/id_dsa ((nil)), debug2: key: /home/testuser/.ssh/id_ecdsa ((nil)), debug2: key: /home/testuser/.ssh/id_ed25519 ((nil)), debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/testuser/.ssh/id_rsa debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: pkalg ssh-rsa blen 279 debug2: input_userauth_pk_ok: fp 25:25:25:25:25:25:25:25:25:25:25:25:25:25:25:25 debug1: key_parse_private2: missing begin marker debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Trying private key: /home/testuser/.ssh/id_dsa debug1: Trying private key: /home/testuser/.ssh/id_ecdsa debug1: Trying private key: /home/testuser/.ssh/id_ed25519 debug2: we did not send a packet, disable method debug1: Next authentication method: keyboard-interactive debug2: userauth_kbdint debug2: we sent a keyboard-interactive packet, wait for reply debug1: Authentications that can continue: publickey,password,keyboard-interactive debug2: we did not send a packet, disable method debug1: Next authentication method: password [email protected]'s password:
Key is in /users/testuser/.ssh/authorized_keys on the target host.
sshd_config has the directives for RSAAuthenticatio, PubkeyAuthentication set to yes, and agents are set to yes.
Is this an outstanding issue? or is there something I'm doing wrong?
Authentication with passwords is working fine, but I'm trying to get key based authentication working.
TIA for any assistance.
The text was updated successfully, but these errors were encountered: