SSH is the secure shell program for connecting to remote servers. It’s also used as a transport mechanism for Git and many other tools. Part of how SSH works is based on public key cryptography, in which you have a private key accessible only to you, and a corresponding public key that you can share with anyone.
Inside your debian-liucs virtual machine, open a terminal window.
At the terminal prompt (
$), type the following command and press enter:
It should produce output like the following. You will have to press enter three more times (shown as ⏎ below): once to use the default file name, and twice to enter an empty passphrase. Your fingerprint, ID, and “randomart” will differ from mine, of course.
Generating public/private rsa key pair. Enter file in which to save the key (/home/liucs/.ssh/id_rsa): ⏎ Created directory '/home/liucs/.ssh'. Enter passphrase (empty for no passphrase): ⏎ Enter same passphrase again: ⏎ Your identification has been saved in /home/liucs/.ssh/id_rsa. Your public key has been saved in /home/liucs/.ssh/id_rsa.pub. The key fingerprint is: a9:84:3a:69:07:8d:2f:94:0e:4a:f6:27:62:b8:04:ad liucs@liucs The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | . + . . | |oo* o . S | |*=.= . . | |E+Boo.. | |oo.+o | |. | +-----------------+ liucs@liucs:~$
Your public key is now in the file
~/.ssh/id_rsa.pub. To find it, open the file manager.
Files and directories that start with a dot are hidden by default. From the View menu, select Show Hidden Files. Then double-click the
When you double-click the
id_rsa.pub file, it will open in medit, the default text editor.
Depending on your course or project, you may have to submit this public key. It is one very long line. Use control-A (or Edit » Select All) and then copy and paste wherever it is needed.
If we are using my
email@example.com server, just paste the key into an email to me, along with your name.
If we are using GitHub, log in to
https://github.com/ in your browser and select Account Settings in the upper right. Then, in the section SSH Keys, you’ll find a button Add SSH key. Paste your public key into the Key section, and give it whatever title you want. Push the green button to accept.