Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

ssh-keygen.exe hangs for end user (related to issue #836)

Open jeffsilverm opened this issue 4 years ago • 15 comments

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.

jeffsilverm avatar Apr 28 '20 20:04 jeffsilverm

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, image

bagajjal avatar Apr 28 '20 22:04 bagajjal

Are you using the “PowerShell ISE”?

DHowett-MSFT avatar May 02 '20 00:05 DHowett-MSFT

@jeffsilverm - Any update?

bagajjal avatar May 11 '20 17:05 bagajjal

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.

carlossanlop avatar Jul 02 '20 03:07 carlossanlop

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.

IAmIlliest avatar May 13 '21 23:05 IAmIlliest

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 avatar Feb 28 '22 13:02 lukescharf

@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

Orsucciu avatar Mar 10 '22 22:03 Orsucciu

I took am having the same issue. Freezes in Powershell at that prompt, works in CMD.

joezappie avatar Aug 03 '22 18:08 joezappie

Same issue with freezing. Running Windows PowerShell as Administrator fixed the issue for me.

smangancap avatar Sep 16 '22 19:09 smangancap

Me too. Windows 10 Pro. PSVersion | 5.1.19041.1682

Redimido-PS avatar Oct 19 '22 11:10 Redimido-PS

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

salavatov avatar Feb 02 '23 22:02 salavatov

Likewise - Windows 10 Pro 10.0.19044, PS version 5.1.19041.2673. cmd works.

enoch-ng avatar Mar 23 '23 02:03 enoch-ng

Same issue faced here on powershell, ssh-keygen -t ed25519 -C "" freezes at Enter file in which to save the key step, the input field blinks continously but no response after that.

SadaGowda avatar Jan 04 '24 07:01 SadaGowda

Same issue, admin mode fixed it

thatnzguy avatar Mar 31 '24 19:03 thatnzguy

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.

jeffsilverm avatar Apr 01 '24 03:04 jeffsilverm