Enter file in which to save the key

Shaun Luttin picture Shaun Luttin · Oct 31, 2014 · Viewed 14.3k times · Source

When generating an SSH key with OpenBSD, we are asked to enter a file in which to save the key.

ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/TheUser/.ssh/id_rsa):

From reading the OpenBSD manual pages, I understand that the file we enter will store the private key and another file with a .pub extension will store the public key.

Normally this program generates the key and asks for a file in which to store the private key. The public key is stored in a file with the same name but “.pub” appended.

The GitHub pages on Generating SSH Keys says that we should just press enter to continue here. My sense is that means we'll just use a default file, which I assume is in the parentheses, for example: (/c/Users/TheUser/.ssh/id_rsa).

Is what I wrote above correct? Also, what are the implications of actually entering a file in which to save the key rather than just pressing enter as GitHub suggests? While I'm pretty sure that id_rsa is just the default, and that it can be anything, I would like to know the conventions.

Answer

arved picture arved · Nov 12, 2014

If you use a non default file name, you have to tell ssh to use this keyfile.

For example by adding to your .ssh/config

IdentityFile ~/.ssh/yourcustomfilename

or by using

# ssh -i ~/.ssh/yourcustomfilename