Cygwin cannot generate ssh keygen

0

1

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

Abu

Posted 2019-07-21T04:51:35.133

Reputation: 1

Answers

0

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=... 
$

Hannu

Posted 2019-07-21T04:51:35.133

Reputation: 4 950

So could you give ay examples for using cygpath? – Abu – 2019-07-22T17:02:05.740

cygpath --help will show you examples if I remember correctly. I'm running Linux nowadays, all computers cleansed, no Windows infection, so cannot verify cygwin examples. IF -u is the cygpath option to print "Unix" paths, then the example I provided above will be correct. – Hannu – 2019-07-23T18:07:00.683

0

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.

EML

Posted 2019-07-21T04:51:35.133

Reputation: 343

Neither WinSCP nor PuTTy does not come with ssh-keygen (they come with PuTTYgen). – Martin Prikryl – 2019-07-24T13:16:15.857

@MartinPrikryl: well, I guess you would know... :) – EML – 2019-07-24T13:45:10.677

0

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.

Martin Prikryl

Posted 2019-07-21T04:51:35.133

Reputation: 13 764