SSH is the “Secure Shell,” a way to securely log in to a remote machine, without worrying that your communications with the server have been compromised.
SSH uses what’s known as a “key pair” to communicate securely. The key pair consists of two keys, one public and one private. The public key can be distributed freely, without worry. You can safely email it, post it on your blog, send it though a chat program, without fear of weakening the security of your systems.
(You can even give your key to a friend, have them add it to their list of authorized keys and securely log in as them.)
The private key, however, must be kept secure and never shared.
SSH Keys can of course be used with the SSH program, a kind of remote terminal, but they also can be used for authentication with sites like GitHub.
If you’re using a Linux system or a Mac, you already have SSH. If you’re on Windows and haven’t done so already, install the Git Bash package for Windows.
Open up your terminal and type the following:
ssh-keygen -b 4096
This will start generating a key pair with a strength of 4096 bytes. It will ask you where you want to save the pair–just go with the default for now and hit enter.
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jim/.ssh/id_rsa):
Next, you’ll be asked for a passphrase. Type in a good one,but don’t forget it, as it is not recoverable. You will not see the characters you type. Hit enter when you have finished:
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jim/.ssh/id_rsa.
Your public key has been saved in /home/jim/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
| . . . o.o |
| . . + o o . |
| . . E + + |
| o .o * o |
| ++S B . |
| oooo= o + . |
| oooo*.+ o |
| .+o oBo. . |
| o+o+.o. o. |