Wilf's Corner

Generate SSH key pair from the command line

Using an SSH key pair is my perfered method of authenticating with a server, such as web hosting.

From the command line:

ssh-keygen -t rsa -b 4096 -C "my config description"

  • -t rsa: Specifies the type of key to create (RSA)
  • -b 4096: Specifies the number of bits in the key 
  • -C  An optional comment to describe the key

2 files will be generated, a private key and a public key (.pub extension). The public key is used on the hosting site. The private key is never shared. 

Files can be edited with a text editor.