Skip to main content

Adding SSH Keys in cPanel - Knowledgebase / cPanel Shared Web Hosting - Micron21 Helpdesk

Adding SSH Keys in cPanel

Authors list

Overview:

Creating an SSH Key in cPanel and connecting to your server via SSH is a secure way to access your server and perform command-line tasks. By default, our shared web hosting services do not include shell access as part of their package, however, you can request that this be enabled by contacting our Micron21 Support team directly.

Prerequisites:

  1. Ensure that Shell/SSH access has been enabled for your specific account. You can email our Micron21 Support team and have them enable it on your behalf.

  2. Authorise your local IP address using the FTP/SSH Web Authenticator.  If you're not sure how this is done, you can review our guide here.

Creating and authorising SSH keys:

Create a new SSH key using the cPanel generator, save the key locally and connect using an SSH application.

  1. Log into your cPanel hosting service.

  2. Navigate to the "SSH Access" tool in the "Security" category.

  3. Click the "Manage SSH Keys" button.

  4. In the "Manage SSH Keys" page, click on the "Generate a New Key" button.

  5. Fill in the required information to generate the key.

    1. Key Name: Default is id_rsa.

    2. Key Password: Set a strong password for the key, and save it in a secure place.

    3.  Re-enter Password: Re-type the password you set.

    4. Key Type:  RSA or DSA - if unsure, leave this as the default.

    5. Key Size: We recommend 2048 (or 4096 where possible).

  6. Click "Generate key",  this will generate the public and private key combination and save it to the following path:
    Your identification will be saved in /home/USER/.ssh/KEYNAME.
    Your public key will be saved in /home/USER/.ssh/KEYNAME.pub.

  7. Authorise your key by clicking "Go Back" or navigating to the "Manage SSH Keys" page again.

  8. Under "public Keys" click manage on the new key you created then click "Authorize".

  9. Navigate to the file using the "File Manager" tool in cPanel, you will need to show hidden files as the directory is a dotfile.

  10. Download the private Key and save it in a secure location on your local machine. (Right-click the file and select download).


Connecting to the server by SSH: 

  1. Open your SSH connection application, such as puTTY or Windows Terminal, on your local computer.

    1. The default for windows devices: Command Prompt.

    2. The default for Mac: Devices Terminal.

  2. Type the command ssh username@yourdomain.com -i /path/to/privatekey and press enter.

    1. The username will be your primary cPanel username.

  3. If prompted, enter the passphrase for the private key.

  4. You should now be connected to the server via SSH and can perform command-line tasks.


Helpful Unhelpful