Skip to content
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

windows 10 SSH not accepting password from fedora command line but goes through in pwsh prompt #2333

Open
3 tasks done
eliassal opened this issue Mar 1, 2025 · 6 comments

Comments

@eliassal
Copy link

eliassal commented Mar 1, 2025

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

I’ve just starting with win32-openSSH on a win 10 machine,added in sshd_config_default at
C:\Windows\System32\OpenSSH the following

PasswordAuthentication yes
KerberosAuthentication yes
PubkeyAuthentication yes

restarted the service.
Trying to connect to my win 10 from a fedora box on command line, I get connected,

The authenticity of host 'salam7 (192.168.1.4)' can't be established.
ED25519 key fingerprint is SHA256:7rDLx/C2FOBflw1JfESBEgVo6N5lbCUKN0LGetSljNI.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

I accept then I get prompted to enter password. I do enter my password but it is not recognized as follows:

salam7salam@salam7's password:
Permission denied, please try again.
salam7salam@salam7's password:

salam@fedora:~$ ssh SALAM\salam@salam7
SALAMsalam@salam7's password:
Permission denied, please try again.
SALAMsalam@salam7's password:

salam@fedora:~$ ssh salam\salam@salam7
salamsalam@salam7's password:
Permission denied, please try again.
salamsalam@salam7's password:

However, when I try the same from a pwsh prompt it goes through

Expected behavior

Connect through ssh from a linux machine to win 10 machine

Actual behavior

nor recognizing password

Error details

Environment data

PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Fedora Linux 41 (Forty One)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

latest

Visuals

No response

@StevenBucher98
Copy link
Collaborator

This is sorta sounding like some problem with the default terminal in Fedora, @eliassal are you able to connect to a linux via the same fedora prompt? Trying to hone in on if this is an issue with the sshd/termina/client etc.

@StevenBucher98 StevenBucher98 added the Waiting on Author Need more information to diagnose label Mar 3, 2025
@eliassal
Copy link
Author

eliassal commented Mar 3, 2025

Yes of course Steven, I connect to almost 10 other VMs using ssh

@StevenBucher98 StevenBucher98 added Investigate 0 - Backlog and removed Waiting on Author Need more information to diagnose labels Mar 10, 2025
@mgkuhn
Copy link

mgkuhn commented Mar 23, 2025

Reading
https://www.gnu.org/software/bash/manual/bash.html#Quoting
will lead you to the solution.

@mgkuhn
Copy link

mgkuhn commented Mar 23, 2025

If you replace the command ssh in your bash command line with echo, you will see what command line arguments you are actually passing on to ssh. Note that your backslash never reaches ssh because it is an unquoted shell metacharacter.

@eliassal
Copy link
Author

eliassal commented Apr 2, 2025

Correct, I added quotes to the slash and I was able to ssh to the win box as follows

ssh mydomain'\'myuser@mycomputer
and landed in a powersehll session on the remote win10
Tell me please, why I land in a PS session and cmd?
Thanks again

@mgkuhn
Copy link

mgkuhn commented Apr 2, 2025

Glad to hear your issue is solved.

Tell me please, why I land in a PS session and cmd?

You can set in the registry which kind of default shell sshd should start for you, as described at

https://github.com/PowerShell/Win32-OpenSSH/wiki/DefaultShell

Check the current setting:

Get-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH"

Switch to Powershell:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "/c" -PropertyType String -Force

Undo the above:

Remove-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell
Remove-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants