windows 10 SSH not accepting password from fedora command line but goes through in pwsh prompt
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest version
- [x] 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
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.
Yes of course Steven, I connect to almost 10 other VMs using ssh
Reading https://www.gnu.org/software/bash/manual/bash.html#Quoting will lead you to the solution.
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.
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
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