How to Add and Use an SSH Key in cPanel

How to Add and Use an SSH Key in cPanel

If you want to access SSH in cPanel, you can log in directly using your cPanel username and password, or you can use an SSH Key for a more secure login.

In this article, we will discuss how to easily add and use an SSH Key in cPanel.

But before that, in this tutorial we will use the PuTTY application for SSH access, and the key will be created using the SSH Key generator available in cPanel.

1. Create an SSH Key

To create an SSH Key directly from cPanel, you can log in to cPanel and open the SSH Access page to manage or create a new key.

Cara Menambah dan Menggunakan SSH Key di cPanel - 1-1

Once you are on the SSH Access page, you can click the button Manage SSH to check the list of SSH keys already saved in your cPanel hosting, or you can also add a new key.

Cara Menambah dan Menggunakan SSH Key di cPanel - 1-2

Since the cPanel I am using is still empty, we can add a new key by creating one, or by importing a key that was created previously, for example using PuTTYgen.

However, since I have not created a key here, I will just create a new one using cPanel and then download the private key used for logging in.

Cara Menambah dan Menggunakan SSH Key di cPanel - 1-3

After pressing the Generate a New Key button, you can fill in data such as the key name, password, key type, and key size. For the key type and size, you can just leave them as RSA 2048. You only need to enter the key name and password, then click the button Generate Key

Cara Menambah dan Menggunakan SSH Key di cPanel - 1-4

At this point, you have successfully created an SSH Key, but it cannot be used yet because the key has just been created and has not been authorized, so you need to authorize the key so it can be used.

Cara Menambah dan Menggunakan SSH Key di cPanel - 1-5

2. Authorize the SSH Key

After successfully importing or adding an SSH Key, you can authorize it by clicking the button Manage on the public key that has been added.

Cara Menambah dan Menggunakan SSH Key di cPanel - 2-1

After opening the menu Manage, you can directly click the button Authorize to grant permission for the SSH Key to be used.

Cara Menambah dan Menggunakan SSH Key di cPanel - 2-2

Now the SSH Key you added is ready to be used once the key status in cPanel is authorized, so you only need to download the key and access SSH.

3. Download the SSH Key

For SSH access, you only need to download the Private Key file, so you can click on the link View/Download on the private key you will use.

Cara Menambah dan Menggunakan SSH Key di cPanel - 3-1

Because we will access SSH here using PuTTY, we need to convert the key format to a .ppk file, which you can do at the bottom of the download page. Enter the password or passphrase you used when creating the SSH Key.

Cara Menambah dan Menggunakan SSH Key di cPanel - 3-2

After converting, you can then download the .ppk file and save it to your device.

Cara Menambah dan Menggunakan SSH Key di cPanel - 3-3

4. Access SSH

All preparations are complete, and now you just need to log in to SSH using the SSH Key with the PuTTY application.

If you do not have the application yet, you can download it first from this page: www.putty.org

After installing PuTTY, just open the application and then in the Host Name field, you can enter your server domain name or the server IP address you are using, for example here using re.viw.my.id to access the cPanel server being used.

Additionally, for the port section, you can use the default 22, or it can be adjusted to the port used on your server.

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-1

After the data is filled in, do not click open immediately, but you need to open the menu Connection > SSH > Auth, then add the private key with the .ppk file you downloaded.

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-2

Once you have added the .ppk file, you can then click the button Open to start accessing SSH.

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-3

If a notification appears Security Alert, you can continue by clicking the button Accept, or also Connect Once

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-4

Enter your cPanel username and the SSH Key passphrase or password (not your cPanel password) so you can connect to SSH.

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-5

Now you have successfully accessed SSH and can run commands supported on your cPanel, for example using ll to check files and folders.

Cara Menambah dan Menggunakan SSH Key di cPanel - 4-6

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...