Group: Systems Administrators/Creating a SSH KeyPair

From LibrePlanet
Jump to: navigation, search

Generating a SSH Public and Private Key

What is a SSH Key?

An SSH key is a crytographic key that lets you log into remote machines with a program called ssh. A SSH key is split into two parts, **public** and **private**.

Private Key

You should protect as much as you would your real password. With this someone can log into your accounts. Private keys can have passwords, but this only slows down someone attempting to gain unauthorized access.

Public Key

Your public key is given out and put on machines you have been granted access to, since it is the public part of your SSH key it can saefely be sent out via emai and other plain text methods.

How Do I Generate One?

Do I Already Have One?

Before you create a key you should make sure you have not already.

To do this run the command (# is the shell prompt):

 # cat ~/.ssh/id_rsa.pub

If your key exists, it will be displayed to the screen.

Creating your SSH Key

1. Run the command, replacing 'me@example.com' with a user name and host name:

 # ssh-keygen -b 4096 -C me@example.com -t rsa

2. You will then prompted where to save your key, press <ENTER> to use the default location.

3. Next you will be prompted for a passphrase for your key. This is optional, using a password adds an additional layer of security to your key.

4. Confirm your password (if nothing, just press <ENTER> again).

5. Your fingerprint (and possibly randomart) will be displayed, it will look something like:

30:ca:86:e9:a0:d6:71:2a:5b:89:ed:ae:71:b3:2c:82 user@libreplanet
The key's randomart image is:
+--[ RSA 4096]----+
|                 |
|                 |
|      o          |
|   + . o         |
|. o.+.  S        |
|.o+.=            |
|o=.O             |
|E.O o            |
|.o+=             |
+-----------------+