You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
10.4.0.0p1-Preview: SSH sessions no longer get the user's PATH (HKCU\Environment), only the machine PATH #2474
Make sure you are able to repro it on the latest version
Search the existing issues.
Steps to reproduce
Give a user one or more entries in their user PATH ([Environment]::GetEnvironmentVariable("Path","User")).
Install 10.4.0.0p1-Preview and SSH in as that user.
Compare $env:Path -split ';' against the user and machine PATH values.
Expected behavior
the session PATH contains the machine entries followed by the user entries, as on 10.0.0.0p2-Preview (and as in an interactive logon).
Actual behavior
only the machine entries are there. On the test machine, all 10 user entries were missing, so profile code that calls user-installed tools (here, oh-my-posh) fails at login.
Error details
Environment data
- Windows 11 26H2, build 26300.9711, x64
- OpenSSH installed from the MSI (OpenSSH-Win64-v10.4.0.0.msi)
- DefaultShell = C:\Program Files\PowerShell\7\pwsh.exe (7.6.7)
- Login with a public key, as a local administrator (administrators_authorized_keys)
Thanks for looking at this. I ran all three on the same machine and account, A/B against 10.0.0.0p2-Preview with an in-place MSI upgrade between the two runs. Clarification first: by "as in an interactive logon" I meant a Windows console/RDP logon, not an interactive SSH session. It happens in every kind of SSH session.
User PATH entries present in the session (10 expected):
Session type
10.0, pwsh
10.0, cmd
10.4, pwsh
10.4, cmd
Non-interactive, no pty (ssh user@host $env:Path / echo %PATH%)
10/10
10/10
0/10
0/10
Non-interactive with pty (ssh -t user@host <cmd>)
10/10
10/10
0/10
0/10
Interactive shell (ssh -tt user@host)
10/10
10/10
0/10
0/10
The machine PATH is complete in every cell (16/16).
DEBUG3: no LoadUserProfileW() message at all, from either version. No error-level lines in sshd-session.log during session setup, and nothing above Information in OpenSSH/Operational. None of the Failed to get the value for registry key ... errors that get_registry_key_value() (from Fix user environment block construction openssh-portable#813) would log appear either.
Non-interactive: yes, same result (table above).
Without PowerShell: yes, same result with DefaultShell set to C:\Windows\System32\cmd.exe.
Other observations from inside the 10.4 sessions, in case they help narrow it down:
HKCU\Environment is readable, and every other variable defined there (TEMP, TMP, OneDrive, OneDriveConsumer, POSH_THEMES_PATH, POSH_INSTALLER, ChocolateyLastPathUpdate) is present with the user's values (TEMP is the per-user path). So the profile looks loaded and only PATH is affected.
The session PATH is exactly the HKLM Session Manager\Environment PATH, same entries in the same order. The user's Path value is REG_SZ.
It isn't picking up the SYSTEM hive either: HKU\S-1-5-18\Environment has its own Path value, and none of its entries appear.
The account also had an active RDP session at the time, so its profile hive was already loaded.
10.4 DEBUG3 excerpt: ssh user@host "echo %PATH%" with cmd as DefaultShell (session start to spawn)
The 10.0 run of the same command logs the same sequence (apart from string escaping), with nothing about the profile or the environment in either.
Environment: Windows 11 26H2 (26300.9711) x64; OpenSSH from the MSI (OpenSSH-Win64-v10.4.0.0.msi / OpenSSH-Win64-v10.0.0.0.msi); public key login as a local administrator (administrators_authorized_keys); default sshd_config plus SyslogFacility LOCAL0 and LogLevel DEBUG3 for this test. Happy to run anything else.
Activity
tgauth commentedon Oct 21, 2026
Are you able to modify the setup to test the following and see what happens?
DEBUG3logging in sshd_config, restart the service, and see if there is anything in logs regarding aLoadUserProfileW()failure.ssh user@host $env:Pathedit: just read the "and as in an interactive logon" - can you clarify if this is only happening for non-interactive logins?
wasserja commentedon Oct 22, 2026
Thanks for looking at this. I ran all three on the same machine and account, A/B against 10.0.0.0p2-Preview with an in-place MSI upgrade between the two runs. Clarification first: by "as in an interactive logon" I meant a Windows console/RDP logon, not an interactive SSH session. It happens in every kind of SSH session.
User PATH entries present in the session (10 expected):
ssh user@host $env:Path/echo %PATH%)ssh -t user@host <cmd>)ssh -tt user@host)The machine PATH is complete in every cell (16/16).
LoadUserProfileW()message at all, from either version. No error-level lines insshd-session.logduring session setup, and nothing above Information in OpenSSH/Operational. None of theFailed to get the value for registry key ...errors thatget_registry_key_value()(from Fix user environment block construction openssh-portable#813) would log appear either.DefaultShellset toC:\Windows\System32\cmd.exe.Other observations from inside the 10.4 sessions, in case they help narrow it down:
HKCU\Environmentis readable, and every other variable defined there (TEMP,TMP,OneDrive,OneDriveConsumer,POSH_THEMES_PATH,POSH_INSTALLER,ChocolateyLastPathUpdate) is present with the user's values (TEMPis the per-user path). So the profile looks loaded and onlyPATHis affected.Session Manager\EnvironmentPATH, same entries in the same order. The user'sPathvalue isREG_SZ.HKU\S-1-5-18\Environmenthas its ownPathvalue, and none of its entries appear.10.4 DEBUG3 excerpt:
ssh user@host "echo %PATH%"with cmd as DefaultShell (session start to spawn)The 10.0 run of the same command logs the same sequence (apart from string escaping), with nothing about the profile or the environment in either.
Environment: Windows 11 26H2 (26300.9711) x64; OpenSSH from the MSI (
OpenSSH-Win64-v10.4.0.0.msi/OpenSSH-Win64-v10.0.0.0.msi); public key login as a local administrator (administrators_authorized_keys); defaultsshd_configplusSyslogFacility LOCAL0andLogLevel DEBUG3for this test. Happy to run anything else.o-sdn-o commentedon Oct 22, 2026