Actions

EmSys

Git - Generating Your SSH public Key

From EdWiki

Generating Your SSH public Key

  • User's SSH keys are stored in that user's ~/.ssh directory.
$ ls ~/.ssh 
id_rsa  id_rsa.pub  known_hosts
  • The id_rsa.pub file is your public key, and the other file id_rsa is your private key
  • If you don't find id_rsa, id_rsa.pub OR you don't even have ~/.ssh directory, create them using a program called ssh-keygen which is provided with the SSH package on Linux systems and comes with the MSysGit package on Windows.
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jshankar/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:  
Your identification has been saved in /home/jshankar/.ssh/id_rsa.
Your public key has been saved in /home/jshankar/.ssh/id_rsa.pub.
The key fingerprint is:
c9:d8:6b:7b:c5:bb:97:75:0e:34:a3:bf:65:03:b1:75 jshankar@edes25
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|             . .E|
|       + .    B .|
|      . S  . = o |
|         .  + o o|
|        o  . o *+|
|       . .. . +oo|
|        ..  .o.. |
+-----------------+
  • First, it confirms where you want to save the key (~/.ssh/id_rsa), and then it asks twice for a passphrase, which you can leave empty if you don't want to type a password when you use the key.
  • After creating the SSH public key (id_rsa.pub) file, please e-mail this file to haresh@cedt.iisc.ernet.in OR jshankar@cedt.iisc.ernet.in.