Linux create ssh keys

These instructions are for a Linux system, but if you install Git for Windows ( msysgit.github.com), you will receive a shell and terminal capability.

Usual ssh-keygen will write to ~/.ssh/id_rsa (creates 2 files). In Linux, ~ means $HOME, usually something like /home/your-name-here. In Windows, in the Git BASH terminal, you run “env” and you’ll see how it guessed for $HOME.

We recommend this to beef this up

# ssh-keygen -t rsa -b 4096 -f ~/.ssh/my_key_name -C “your-email-address@wherever”

You need the -C thing sometimes because some servers will insist you use a SSH key that is linked to your login. For example, GitHub and Debian Mentors do that.

I did not put put the -C option in this example, by mistake.

Run that,you see this:

$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/my_key_name
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/pauljohn/.ssh/my_key_name.
Your public key has been saved in /home/pauljohn/.ssh/my_key_name.pub.
The key fingerprint is:
b3:b5:59:69:33:17:a1:23:6e:80:e7:d0:48:44:9b:96 pauljohn@hpc

The reason to add -f argument is to name the file so as to protect your old id_rsa in case you rely on it.

About pauljohn

Paul E. Johnson is a Professor of Political Science at the University of Kansas. He is an avid Linux User, an adequate system administrator and C programmer, and humility is one of his greatest strengths.
This entry was posted in Linux. Bookmark the permalink.