Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a SSH key with ssh-keygen does not create the .ssh folder

I am trying to create my public/private rsa key pair with msysgit

I run this command:

ssh-keygen -C "[email protected]" -t rsa

Everything looks fine, I have the message

Enter file in which to save the key (/c/Users/user/.ssh/id_rsa)

Then I have the confirmation:

Your public key has been saved in project.pub

But I can't access the folder! It does not exist, it is not even an hidden folder. I don't understand why it does not generate. I am using Windows 7 Ultimate.

like image 972
Charles Ouellet Avatar asked Jun 19 '10 15:06

Charles Ouellet


People also ask

Does ssh-keygen create the .ssh directory?

ssh folder.

How is .ssh folder created?

Run ssh-keygen to generate an SSH key-pair. Retrieve the public key file. Provide the public key file (for example, id_rsa. pub) to your server administrator so that it can be set up for your server connection.

What does ssh-keygen create?

By default, ssh-keygen creates an RSA key pair and stores the public key in a public key file named . ssh/id_rsa. pub and a private key file named .


2 Answers

Just created my key without any problem (Seven Ultimate 64bits, msysgit 1.6.5.1.1367.gcd48)

$ ssh-keygen -C "vonc@xxxx" -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/VonC/.ssh/id_rsa):# just press enter
                                                                # to accept the
                                                                # default location
Enter passphrase (empty for no passphrase):                     
Enter same passphrase again:
Your identification has been saved in /c/Users/VonC/.ssh/id_rsa.
Your public key has been saved in /c/Users/VonC/.ssh/id_rsa.pub.
The key fingerprint is:
xx:yy:zz:aa:bb:cc:... vonc@xxxx

With the result:

VonC@P ~/.ssh
$ ls -alrt
total 10
-rw-r--r--    1 VonC Administ      642 May 23 21:47 known_hosts
drwxr-xr-x   43 VonC Administ    16384 Jun 15 17:01 ..
-rw-r--r--    1 VonC Administ      398 Jun 19 16:14 id_rsa.pub
-rw-r--r--    1 VonC Administ     1675 Jun 19 16:14 id_rsa
drwxr-xr-x    2 VonC Administ        0 Jun 19 16:14 .

Could you check in your bash session what value your $HOME environment variable is set?

VonC@P ~/.ssh
$ env|grep HOME
HOMEPATH=\Users\VonC
HOME=/c/Users/VonC     # <=== this must be correctly set
HOMEDRIVE=C:
like image 179
VonC Avatar answered Oct 02 '22 16:10

VonC


I had the same problem and I realized I was trying to enter a file name when it asks for the following "Enter file in which to save the key (c/users/user.name/.ssh/id_rsa)"

Rather just enter nothing and press Enter key to use the default and you will move on.

like image 29
Amit Avatar answered Oct 02 '22 17:10

Amit