Can't figure out SSH keys

February 19, 2015 1.9k views

For this tutorial: [https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04](http://)

I do not understand step 2: It says: Once you have entered the Gen Key command, you will get a few more questions: Enter file in which to save the key (/home/demo/.ssh/id_rsa):

So where is this "file". I created a file path on my home computer under "my documents", but nothing was created in that folder. Is the "file" the key is saved to on the Ubuntu server? This step needs clarification.

instead of "demo" I named my user after me: matthewtae

So I typed: (/home/matthewtae/.ssh/idrsa)
I receive the message: No such file or directory.
Saving the key failed: (/home/matthewtae/.ssh/idrsa).

Soooo.... the tutorial needs to be clearer about that step, where to "save the key" to. Where am I actually saving the key to? To my local hard drive that is sitting on my desk? Or to some place on the server?

3 Answers


You generate the key on your local computer. It will create two different files. A public key and a secret key. The public one is what you add in the DigitalOcean control panel.

When you are presented with the prompt:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/localuser/.ssh/id_rsa):

You can either type out the full path to a file where you'd like to save the key file or you can simply press enter and it use the default path, which is what is shown in parentheses.

Check out this tutorial for a more detailed look:

SSH, or secure shell, is the most common way of administering remote Linux servers. Although the daemon allows password-based authentication, exposing a password-protected account to the network can open up your server to brute-force attacks. In this guide, we demonstrate how to configure your server with SSH keys, which is the recommended authentication method. These are much more difficult for attackers to work around, giving you a more secure login mechanism.
  • Thanks... I did type out a full file path where I wanted the keys saved.. But when I open that folder, there is nothing in there! The file path that I tried on my computer was: C:\Users\Matthew.ssh/id_rsa). I get a message saying they keys have been created, but there is no file that remotely looks like a key! Is it invisible or something? Why can't I see it?

    When I try what is suggested (i.e. Users/localuser/.ssh/id_rsa)

    I get the message - open (/Users/localuser/.ssh/idrsa) failed: No such file or directory.
    Saving the key failed: (/Users/localuser/.ssh/idrsa).

  • @tae Are you using Windows? If so, it might be easier to use PuTTY.

    by Justin Ellingwood
    PuTTY is a Windows program used to establish SSH sessions with Linux servers. In this guide, we'll demonstrate how to use PuTTY to create SSH key pairs to use within the DigitalOcean interface. You can then easily create servers that you can log into without a password.
  • I am using PuTTy. Here's a screenshot of what I wrote in, I highlighted the section I just did. Before that, you'll see the errors when I try to type in what is recommended https://www.flickr.com/photos/43326914@N06/16396554040/

    So after that is created.. I go to that file path, nothing is in that folder! The folder shows nothing in it. IF keys were created, where are they?

I followed the instructions in the link you posted, i.e. just hit "enter" when a file path is requested. However, the result is not the same. The tutorial say the file path should be:
Your identification has been saved in /home/username/.ssh/idrsa.
Your public key has been saved in /home/username/.ssh/id
The key fingerprint is:
a9:49:2e:2a:5e:33:3e:a9:de:4e:77:11:58:b6:90:26 username@remote_host
The key's randomart image is:
+--[ RSA 2048]----+
| ..o |
| E o= . |
| o. o |
| .. |
| ..S |
| o o. |
| =o.+. |
|. =++.. |
|o=++. |

However, in my screenshot here, the "Your identification has been saved in...." is different: https://www.flickr.com/photos/43326914@N06/16396580278/

Something is wrong here. Where is the SSH key? I can't find it on my hard drive.

  • It looks like you are trying to generate the local key on the remote host. This will not work. You need to generate a local key on your local computer. The guide in your first post expects you to use some kind of linux/unix on your local machine. You could try to follow this guide on how to use PuTTY and PuTTYgen.

    by Pablo Carranza
    This tutorial runs through creating SSH keys with PuTTY to connect to your virtual server.
Have another answer? Share your knowledge.