How to configure SSH keys using cPanel
Configuring SSH keys using cPanel involves generating a key pair on the server and adding the public key to your server’s authorized keys file. Here’s a breakdown of the steps:
Generating a Key Pair on cPanel:
- Log in to cPanel.
- Navigate to the Security section and find the SSH Access tool.
- Click on Manage SSH Keys.
- Click on Generate a New Key.
- You can choose a name for the key pair or leave the default “id_rsa”.
- Optionally, set a strong password for the key and click Generate Key.
Adding the Public Key to Authorized Keys:
- In the Manage SSH Keys section, you need to scroll down to the Authorized Keys area.
- Next, you have to click on Manage next to the key you just generated.
- A box with the public key will be displayed. You can copy the entire contents of the box.
- Here you’ll need to access your server through another method (like root access or a current SSH connection) and add the copied public key to the authorized_keys file located in the .ssh directory of your home directory.
Downloading the Private Key (for SSH client):
- Go back to the Manage SSH Keys section in cPanel.
- Find the key you have created under Private Keys.
- Click View/Download next to the key.
- You’ll see the option to convert the key to PPK format (if using PuTTY). Then, you have to choose the conversion if needed.
- Click on Download Key and save the private key securely on your local machine. This private key will be used for SSH login with your client program.
Tips:
- Make sure to keep your private key confidential and avoid sharing it with anyone.
- Consult your SSH client’s documentation for specific instructions on using the private key for login.
For a more detailed walkthrough, you can refer to resources like the cPanel documentation or tutorials from web hosting providers.