Your SSH session can be authenticated either with the username and password or with a pair of private/public keys. It is recommended to use the latter, as it is considered to be a more secure and convenient solution.
1. Manage SSH Keys
In cPanel you can manage SSH keys in the SSH access menu. Click on Manage SSH keys. On the next page, you can either import the existing pair of keys or generate a new one.
2. Create a new pair of SSH keys
2.1. Public and private keys generation
In order to generate a new SSH key pair click on the Generate a new Key option. On the generator page, specify the password (passphrase), Key Name, Key Type and Size. We suggest using only RSA with 2048 bits. Once everything is set, click Generate Key.
2.2. Public key authorization
In order to authorize SSH access to your hosting account by the private key you created, click on the Manage option. On the next page, click on the Authorize button.
2.3. Acquiring a key pair
You can view and download keys you have in cPanel by clicking on the View/Download button in the Private Keys section. Click on Download Key or just copy/paste the provided key if needed. You can also convert your key into PuTTY’s ppk format using the Convert option.
3. Import of the existing keys
If you already have a key pair generated by other means, you can import the public key using the Import Key option. Fill in the required details:
- Choose a name for this key: type in id_rsa;
- Paste the Private Key in this box: leave it empty;
- Passphrase: input the passphrase;
- Paste the public key into the following text box: copy and paste the content of your public key file;
- Click Import
Once done, do not forget to authorize your imported public key.
4. Use Putty and SSH key pair to connect
In this example, we will use the Putty SSH client and key pair generated by cPanel:
- Download the Private key.
- In the PuTTy folder, run puttygen.exe; in the top menu select the File tab and click on Load private key and select your private key file.
- You will be asked for the passphrase. After entering it you should receive a successful import message.
- Now click on Save private key and save your key as a .ppk file.
- Run the PuTTy client (putty.exe), select Connection > SSH > Auth and in the Authentication parameters section, click on Browse to select the saved .ppk file.
- Once done, get back to the Session section and input the server name (IP address) and specify SSH port (it should be 21098 for all shared servers accounts) and click Open.
- In the console window, you will be asked for the login and passphrase.
That’s it!
