Trying to boot directly into a SSH session with authentication closes itself immediately #19740

Closed
opened 2026-01-31 06:52:17 +00:00 by claunia · 3 comments
Owner

Originally created by @ToasterDEV on GitHub (Apr 19, 2023).

Windows Terminal version

1.16.10262.0

Windows build number

10.0.22621.0

Other Software

OpenSSH within Ubuntu 22.04.02 LTS running through WSL2.

Steps to reproduce

  1. Create a profile issuing the ssh command to a Linux distro of your choice (For example, C:\WINDOWS\system32\wsl.exe -d Ubuntu ssh -R 52698:localhost:52698 root@192.168.1.1 -p 1025).
  2. Save the profile and attempt to open it.
  3. Since the host we're attempting to access is locked behind an SSH key stored outside the .ssh directory (the private key is stored on a Yubikey through the OpenPGP feature), the console immediately jumps to an exit state before being able to enter the PIN and/or touch the key (Permission denied: (publickey) | root@192.168.1.1: Permission denied (publickey). [process exited with code 255 (0x000000ff)]).

Expected Behavior

The profile should behave as if the same command was called from the distro itself and wait until the key is entered.

Actual Behavior

Using the wsl.exe executable doesn't allow for alternate methods of authentication.

Originally created by @ToasterDEV on GitHub (Apr 19, 2023). ### Windows Terminal version 1.16.10262.0 ### Windows build number 10.0.22621.0 ### Other Software OpenSSH within Ubuntu 22.04.02 LTS running through WSL2. ### Steps to reproduce 1. Create a profile issuing the `ssh` command to a Linux distro of your choice (For example, `C:\WINDOWS\system32\wsl.exe -d Ubuntu ssh -R 52698:localhost:52698 root@192.168.1.1 -p 1025`). 2. Save the profile and attempt to open it. 3. Since the host we're attempting to access is locked behind an SSH key stored outside the `.ssh` directory (the private key is stored on a Yubikey through the OpenPGP feature), the console immediately jumps to an exit state before being able to enter the PIN and/or touch the key `(Permission denied: (publickey)` | `root@192.168.1.1: Permission denied (publickey). [process exited with code 255 (0x000000ff)]).` ### Expected Behavior The profile should behave as if the same command was called from the distro itself and wait until the key is entered. ### Actual Behavior Using the wsl.exe executable doesn't allow for alternate methods of authentication.
claunia added the Issue-BugResolution-ExternalNeeds-Tag-Fix labels 2026-01-31 06:52:17 +00:00
Author
Owner

@DHowett commented on GitHub (Apr 19, 2023):

Thanks for filing! I've got a couple questions...

  1. If you run that commandline directly from CMD or PowerShell, does it work?
  2. What about if you use the legacy Windows Console Host (which you can access by running conhost cmd or conhost powershell)?
@DHowett commented on GitHub (Apr 19, 2023): Thanks for filing! I've got a couple questions... 1. If you run that commandline directly from CMD or PowerShell, does it work? 2. What about if you use the legacy Windows Console Host (which you can access by running `conhost cmd` or `conhost powershell`)?
Author
Owner

@ToasterDEV commented on GitHub (Apr 21, 2023):

Thanks for filing! I've got a couple questions...

Hi! Thanks for the quick response.

Sure, let me see what I can try.

  1. If you run that commandline directly from CMD or PowerShell, does it work?

If I open the default PowerShell Core profile, and enter the following command:

C:\WINDOWS\system32\wsl.exe -d Ubuntu ssh -R 52698:localhost:52698 root@192.168.1.1 -p 1025

The output is as follows:

root@192.168.1.1: Permission denied (publickey).

Mimicking the behavior of using the same string as a launch argument for the profile.

2. What about if you use the legacy Windows Console Host (which you can access by running conhost cmd or conhost powershell)?

Attempting both commands leads to the same behavior on both, so I'm starting to think this might be a WSL issue instead. How would I go about determining the root cause of the issue if so?

Thanks for the help!

@ToasterDEV commented on GitHub (Apr 21, 2023): > Thanks for filing! I've got a couple questions... Hi! Thanks for the quick response. Sure, let me see what I can try. > 1. If you run that commandline directly from CMD or PowerShell, does it work? If I open the default PowerShell Core profile, and enter the following command: `C:\WINDOWS\system32\wsl.exe -d Ubuntu ssh -R 52698:localhost:52698 root@192.168.1.1 -p 1025` The output is as follows: `root@192.168.1.1: Permission denied (publickey).` Mimicking the behavior of using the same string as a launch argument for the profile. > 2\. What about if you use the legacy Windows Console Host (which you can access by running `conhost cmd` or `conhost powershell`)? Attempting both commands leads to the same behavior on both, so I'm starting to think this might be a WSL issue instead. How would I go about determining the root cause of the issue if so? Thanks for the help!
Author
Owner

@carlos-zamora commented on GitHub (Apr 26, 2023):

These are the troubleshooting steps to determine if this was a WSL bug. Since it looks like it is, we recommend following up on the WSL repo. If it does turn out to look like an issue on our end, we'd be happy to reopen and investigate! 😊 Thanks!

@carlos-zamora commented on GitHub (Apr 26, 2023): These are the troubleshooting steps to determine if this was a WSL bug. Since it looks like it is, we recommend following up on the [WSL repo](https://github.com/microsoft/WSL). If it does turn out to look like an issue on our end, we'd be happy to reopen and investigate! 😊 Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19740