How to generate a SSH keypair?
If you want to make a secure connection with SSH, we highly recommend using an SSH keypair. In this article we’ll explain how to create a SSH keypair through cPanel and with the Terminal application.
Generate a keypair with cPanel
To generate a SSH keypair with cPanel, you follow the next steps:
Step 1. Log in on cPanel.
Step 2. Click SSH Access (Section Security)
Step 3. Click Manage SSH Keys
Step 4. Click Generate a New Key
Step 5. Fill in a strong password at Key Password and Reenter Password. Change the Key Size to 4096.
Step 6. Click Generate Key.
Step 7. Your SSH Keypair is now generated. Click Go Back.
Step 8. Click View/Download below Private Keys.
Step 9. Click Download Key to download your private key.
Step 10. Follow the same steps mentioned in steps 8 and 9 but do it under section Public Keys to download your public key.
Generate a keypair with the Terminal application
With a terminal application you can generate a SSH keypair through a simple command:
ssh-keygen
When asked Enter file in which to save the key (/home/users/username/.ssh/id_rsa)”, just press ENTER. Your key pair files will now automatically be called id_rsa (private key) and id_rsa.pub (public key).Fill in a strong password when asked Enter passphrase (empty for no passphrase . Hurray! You’ve created your own SSH keys now. Put them both in your .ssh folder.
Use SSH with SSH Keys
Now you’ve created your very own SSH keypair, it’s time to put the peddle to the medal and use your keys to connect to SSH. How to do this is explained in the article How to login to SSH with SSH keys?