Submit a Ticket
Support Center » Knowledgebase » Generate SSH Key on Linux

Generate SSH Key on Linux

It's very easy to generate a ssh key on Linux!

Execute the following command to generate a SSH key

$ ssh-keygen -t rsa
  Generating public/private rsa key pair.
  Enter file in which to save the key (/home/sample/.ssh/id_rsa): 
  Enter passphrase (empty for no passphrase): 
  Enter same passphrase again: 
  Your identification has been saved in /home/sample/.ssh/id_rsa.
  Your public key has been saved in /home/sample/.ssh/
  The key fingerprint is:
  xxxxxxxxxxxxxxxxxxxxxxxxxx [email protected]
  The key's randomart image is:
  +--[ RSA 2048]----+
  |      E. ..o     |
  |     . ..   o    |
  |      o .  . o   |
  |     . .    =    |
  |        S ..o=   |
  |         ..=ooo  |
  |          .oo .  |
  |         .  .. o |
  |          o+o . .|

The public and private keys will be saved in ~/.ssh/id_rsa (PRIVATE KEY) and ~/.ssh/ (PUBLIC KEY)

Copy the output from, for example you can use cat/nano/vim:

$ cat /home/sample/.ssh/ 
  ssh-rsa sampleeeeeeeeeeeee [email protected]
  1. Open cPanel

  2. Click on SSH Remote Access

  3. Then go to Manage SSH Keys

  4. Click on Import Key

  5. Type name for public key (For example: MyKey1)

  6. Scroll down and paste the public key into “Paste the public key into the following text box:”

  7. Click Import

  8. Back to Manage Keys

  9. Click on Manage on your public key and then Authorize
Now, you can access SSH on the server to which you are trying to connect without password authentication

$ ssh [email protected] -p4747

 This answer was helpful  This answer was not helpful