Win32-OpenSSH
Win32-OpenSSH copied to clipboard
ssh-keygen.exe hangs for end user (related to issue #836)
I am experiencing the same problem as issue 836. ssh-keygen -t rsa hangs at the step "Enter file in which to save the key (C:\users\XXXX.ssh/id_rsa or ssh-keygen -t ecdsa hangs at the step "Enter file in which to save the key (C:\users\XXXX.ssh/id_ecdsa Hitting control-Z will unhang the program, hitting control-C will not. If I use the -P switch, it still hangs. The problem is not seen when I run ssh-keygen under cmd. I suspect the GitHub is not the best forum for this problem - I suspect it is a powershell issue.
This is a tricky issue. We haven't seen this issue before.
Does it happen on a new powershell window? What is the powershell version? Which windows OS version?
This is the right usage of -P on powershell,
Are you using the “PowerShell ISE”?
@jeffsilverm - Any update?
I have a repro, @DHowett-MSFT .
- I have an Arm64 laptop with Windows 10 Enterprise Arm64. Windows version 1909 (OS build 18363.900).
- I am using PowerShell Core 7.0.0-Preview.4 (the latest as of today). It's the x86 version, but I was also able to repro this same issue with the Arm64 experimental version.
- I am not running PS as an administrator.
- I can repro in PowerShell Core.
- I cannot repro in Windows PowerShell (5.1.18362.752).
- I also cannot repro if I run ssh-keygen from cmd.
Please let me know if you need more information.
I'm seeing the same problem as the OP.
It is occurring on Windows 10 Pro: Version 10.0.19042 Build 19042 Version 20H2 (OS Build 19042.985)
I'm using Windows Terminal: Version: 1.7.1033.0
Under Windows Terminal it's a Powershell tab: $PSVersionTable.PSVersion Major Minor Patch 7 1 3 (Get-Host).Version Major Minor Build Revision 7 1 3 -1
In the Powershell tab, it's presumably OpenSSH: ssh -V OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
The command I'm running is just straight ssh-keygen: ssh-keygen
Ctrl+z will get you back out when it hangs at the save file prompt, where as Ctrl+c will not.
EDIT: I'm suspicious it's related to the terminal program (Windows Terminal) or the version of Powershell that it's tab is executing. If I run the same command from a Powershell 7 (x64) window, it does not hang, but it's also an older version: PS C:\Users\Kris.DESKTOP-L5S24O2> (Get-Host).Version Major Minor Build Revision 7 0 3 -1
I'll go and report under the Windows Terminal issues.
EDIT 2: Not sure what the hell the problem is. Updated Powershell core to retest from it's windows (no problem), but checked again from Windows Terminal powershell tab and it now works without hanging..... Not sure if the update to Powershell Core (i.e Powershell 7) is what resolved it, or just having closed Windows Terminal and opened a new one....Confounding factors.
I just experienced this bug this morning with Windows 11 Pro.
ssh-keygen froze at the input-filename prompt under PowerShell (my default shell on Windows).
ssh-keygen succeeded under cmd.exe (not my default shell).
@lukescharf 's solution worked for me
I run windows 11 on an Intel i7, with powershell and all at the latest version at the time of writing this
I took am having the same issue. Freezes in Powershell at that prompt, works in CMD.
Same issue with freezing. Running Windows PowerShell as Administrator fixed the issue for me.
Me too. Windows 10 Pro. PSVersion | 5.1.19041.1682
Same issue. Windows 11 Running from PowerShell as Admin hangs Running from CMD started within admin Powershell still hangs Running in CMD profile works fine
5.1.22000.1335
Likewise - Windows 10 Pro 10.0.19044, PS version 5.1.19041.2673. cmd works.
Same issue faced here on powershell, ssh-keygen -t ed25519 -C "
Same issue, admin mode fixed it
Thatnzguy - does that mean that if you run ssh-keygen as administrator, then it works? That's hardly what I would consider a fix, that's more like an observation. It's an important observation to be sure. Something that works in administrator but not in ordinary accounts, and should not need administrator rights, is clearly broken. Also, if something must have administrator rights and attempts to run without them, then it should give an error message and exit abnormally, as opposed to hanging.