Cygwin cannot generate ssh keygen

I want to generate ssh-keygen via cygwin and there is a problem when I entering path (it doesn't do anything).

Here I just press enter and nothing was done:

enter image description here

0

4 Answers

I think you're probably not running the Cygwin ssh-keygen - what does which ssh-keygen show? The non-Cygwin ssh-keygen on my system (which was installed with PuTTY or WinSCP, I can't remember which) has the same behaviour, but can be made to work with:

ssh-keygen -t rsa -f /cygwin64/home/me/.ssh/id_rsa -N "passphrase"

Note:

  1. Insert your own passphrase instead of passphrase, or -N "" for an empty passphrase
  2. The path has a strange format, and is rooted at C:. I have cygwin installed at C:\cygwin64, so the keys are going in my Cygwin home directory (~/.ssh) in this example. Make .ssh first.

Or you could just install the Cygwin ssh-keygen. which ssh-keygen should then return /usr/bin/ssh-keygen.

4

Use forward slashes for cygwin paths, Backward slash is "the escape character" in linux (and therefore also in cygwin)

$ cygpath --help

cygpath helps to convert paths+filenames for/from/to cygwin.

Hint: Use Linux paths in cygwin, use Windows paths in windows.

Untested example:
$ cygpath -u "C:\Users\User/.shhs/id_rsa" /cygdrive/c/UsersUser/.shhs/id_rsa


What you have typed in your example (C:\Users\User/.shhs/id_rsa) is in the end equal to C:UsersUser/.shhs/id_rsa - which most likely isn't what you want.

The "Escape character" takes the special meaning out of the character after it, normally a special character, leaving the character literally, as is, in the input (there is more to it than so, but enough here).

Example:

$ echo \$PATH=$PATH
$PATH=...
$
2

Consider using Microsoft build of OpenSSH. Just download OpenSSH-Win32.zip or OpenSSH-Win64.zip, extract the ssh-keygen.exe and use – no installation needed, no dependencies (on Cygwin or anything else).

If you have Windows 10 version 1803 or newer, you already have OpenSSH built-in. For older versions, you can also easily install it as an Optional feature "OpenSSH Client".

See also Install OpenSSH SFTP client to Windows 7.

Tumbleweed thread, I know, but I found the solution. The problem is that it's trying to use the native Windows openssh binary and the directory paths collide.

I removed the Windows openssh client, reinstalled cygwin with the cygwin-compiled openssh binaries and it now ssh-keygen works exactly like it should.

Also worth noting that other things were failing (like rsync) for what is likely the same reason.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like