Group: Systems Administrators/Creating a SSH KeyPair

From LibrePlanet
Jump to: navigation, search
(make 4096 bit RSA keys)
(Adding a comma)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
  
 
== What is a SSH 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**.
+
An SSH key is a cryptographic 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 ===
 
=== Private Key ===
Line 8: Line 8:
  
 
=== Public Key ===
 
=== 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.
+
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 safely be sent out via email and other plain text methods.
  
 
== How Do I Generate One? ==
 
== How Do I Generate One? ==
Line 23: Line 23:
  
 
=== Creating your SSH Key ===
 
=== Creating your SSH Key ===
1. Run the command, replacing 'me@example.com' with a user name and host name:
+
1. Run the ssh-keygen command, replacing 'me@example.com' with an email address. If you are missing the ssh-keygen program, install the openssh-client package on Debian-based systems.
 
<pre>
 
<pre>
 
  # ssh-keygen -b 4096 -C me@example.com -t rsa
 
  # ssh-keygen -b 4096 -C me@example.com -t rsa

Latest revision as of 11:17, 1 August 2024

Generating a SSH Public and Private Key

What is a SSH Key?

An SSH key is a cryptographic 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 safely be sent out via email 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 ssh-keygen command, replacing 'me@example.com' with an email address. If you are missing the ssh-keygen program, install the openssh-client package on Debian-based systems.

 # 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+=             |
+-----------------+