Knowledgebase Home / How to connect via SSH using keys
// View Comments //

How to connect via SSH using keys

The SSH network protocol allows you to connect to another web server over the internet via a command-line interface (CLI). You can use this network protocol to remotely manage your server, configure CGI scripts, and perform other tasks. 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.

Quick Steps

  1. Log in to cPanel.
  2. In the SECURITY section of the cPanel home screen, click SSH Access.
  3. Click on Manage SSH keys.
  4. Create a new pair of SSH keys.

Configuring SSH keys For cPanel Basic Theme:

  1. In cPanel you can manage SSH keys in the SSH access menu.
  2. Click on Manage SSH keys.On the next page, you can either import the existing pair of keys or generate a new one.
  3. Create a new pair of SSH keys.3.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 Key Size.DSA keys provide quicker key generation and signing times.RSA keys provide quicker verification times. The maximum allowed DSA key size is 1024 which is not enough to guarantee its security nowadays. That’s why we suggest using only RSA with 2048 bits.

    Once everything is set, click Generate Key. Now you should see both private and public keys you created.

    3.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.

    3.3 Acquiring a key pair.

    You can view and download keys you have in cPanel by clicking on the View/Download button.

    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.

  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 in order to access the server via SSH.4.1 Download the Private key as it is mentioned under Acquiring a key pair ( in step3.3)4.2  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 (make sure All files (*.*) filter is used so you can see your downloaded private key file

    Asked for the passphrase you specified during the key generation in step 2.1. After entering it you should receive a successful import message.

    In case you do not wish to set a passphrase for the key, you can empty the Key passphrase and Confirm passphrase fields.

    4.3 Now click on Save private key and save your key as a .ppk file which will be needed later.

    4.4  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 the SSH port and click Open.

    4.5 In the console window, you will be asked for the login and passphrase.

Conclusion

Remember to always keep your private keys safe. You can use the same key from multiple computers if you wish, or generate new ones on each client connecting to your server for added security. Each user should generate their own key pair and passphrase for secure access control.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
guest
0 Comments
Inline Feedbacks
View all comments