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/id_rsa.pub.
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/id_rsa.pub (PUBLIC KEY)
Copy the output from id_rsa.pub, for example you can use cat/nano/vim:
- Open cPanel
- Click on SSH Remote Access
- Then go to Manage SSH Keys
- Click on Import Key
- Type name for public key (For example: MyKey1)
- Scroll down and paste the public key into “Paste the public key into the following text box:”
- Click Import
- Back to Manage Keys
- 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
