What's new

Welcome to GloTorrents Community

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask Questions and Get Answers from Our Community

Answer

Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

How to generate an SSH key pair in Linux?

_.:=iTake=:._

Administrator
Staff member
ZeuS
Super Moderator
+Lifetime VIP+
Registered
Joined
Oct 20, 2018
Messages
1,370
Reaction score
1,431
Points
113
Credits
14,854
This has proven more secure over standard username/password authentication.
You can generate an SSH key pair directly in cPanel, or you can generate the keys yourself and just upload the public one in cPanel to use with your hosting account.
When generating SSH keys yourself under Linux, you can use the ssh-keygen command. To do so follow these steps:
  • Open up the Terminal
  • Type in the following command:

ssh-keygen -t rsa

  • Next you will have to type in the location of the file where you would like to save the private key.

Enter file in which to save the key (/home/youruser/.ssh/id_rsa):
The public key will be saved in the same location, under the same file name, but with the .pub extension. Type in nothing to use the default location, which is /home/youruser/.ssh/id_rsa.

  • Finally you will have to type in a password. This will be the password required to load the private key and use it to connect via SSH later on:
Enter passphrase (empty for no passphrase):
The entire key pair generation process would look like this:

user@localhost: ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/youruser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 user@localhost

This will create a private key written to /home/youruser/.ssh/id_rsa and a public key written to /home/youruser/.ssh/id_rsa.pub.
The private key needs to be loaded in your Terminal using the ssh-add command:

ssh-add /home/youruser/.ssh/id_rsa
After which you will be asked to enter the passphrase of your key.
 
shape1
shape2
shape3
shape4
shape7
shape8
Top