How To Generate SSH And GPG Keys

Posted By : Mohit Shakya | 31-Dec-2017


In this blog we'll be going through how to generate SSH/GPG keys.
Following are steps:

-> At your console type command

$ ssh-keygen

( you may also customize the parameters some of them are specified at the end of this blog )
-> there will be a prompt to enter file path

$ <enter_path_of_file> 

(you may also skip this blank, but in that case this'll override your default system generated keys @ [ ~/.ssh/id_rsa ])
-> there will be a prompt for passphrase

$ <enter_passphrase> 

(you may also skip this blank, skipping this blank avoid the passphrase entry at key loading time)
-> Now Your final key files pair will be available in either your specified directory or in [ ~/.ssh/id_rsa ]



There will be two files:
1. public key file: '<file_name>.pub' ( this is your public key file )
2. private key file: '<file_name>'  (this is your private key file, will be great to store it with some extention like .pem or .pvt to differentiat [ not in ~/.ssh/id_rsa ])

Also you can customize your generated key using following options too:

$ ssh-keygen -t <crypto_altorithm> -b <bits_length>


crypto_algorithm: supported algorithms are [ dsa | ecdsa | ed25519 | rsa | rsa1 ]
bits_length:    it is key bits length, it may be 1024/2048/4096



$ ssh-keygen -t rsa -b 2048


I hope this will be helpful for you.


Request for Proposal

Recaptcha is required.

Sending message..