Skip to content

How to configure SSH keys using cPanel

When you log into your ruachost server using SSH, you typically enter a password. However, for automated tasks like database backups or allowing multiple users to securely transfer files via SFTP, requiring a password each time can be inconvenient or insecure. By using SSH keys, you can connect to your ruachost server without a password, enabling automatic logins for processes or improved security for multiple users.

SSH keys are a pair of cryptographic keys (public and private) used for authenticating logins. The private key remains on your local machine, while the public key resides on the Ruachost server. You can also use passphrases for additional security.

Option 1: Generating a New SSH Key Pair in cPanel

Section titled “Option 1: Generating a New SSH Key Pair in cPanel”
  1. Log into ruachost cPanel.
  2. Navigate to SSH Access:
    • In the Security section, click on SSH Access.
  3. Generate a New Key:
    • Click Manage SSH Keys, then Generate a New Key.
    • Confirm Key Name is set to id_rsa.
    • Enter a Key Password or use the Password Generator.
    • Ensure Key Type is set to RSA and Key Size is 2048.
    • Click Generate Key.
    • Once generated, the keys will be saved in /home/username/.ssh/.
  4. Authorize the Public Key:
    • Under Public Keys, locate the newly created key and click Manage.
    • Click Authorize to enable it for SSH access.
  1. Log into ruachost.com cPanel.
  2. Navigate to SSH Access.
  3. Import Your Existing Key:
    • Under Manage SSH Keys, click Import Key.
    • Enter a name and paste your public key into the text box.
    • Click Import.
  4. Authorize the Imported Key:
    • Find your imported key under Public Keys, click Manage, and Authorize.
  1. Deploy the private key to your local computer by:
    • Downloading the key from Private Keys in SSH Access and converting it to PPK format.
    • Save the key on your local machine.
  2. Configure PuTTY:
    • Open PuTTY and navigate to SSH > Auth.
    • Load your .ppk private key file.
    • Under Session, enter username@ruachost.com with the port set to 7822.
    • Save the session and connect.
  1. Download the private key to your machine and save it in C:\Users\username\.ssh\.

  2. Open Command Prompt and run: bash

    ssh -p 7822 username@ruachost.com

    If the key is saved in a different directory, specify the key file path with the -i option.

  1. Save the private key in /home/username/.ssh/.

  2. Open Terminal and run: bash

    ssh -p 7822 username@ruachost.com
  3. To avoid typing your passphrase repeatedly, add this to ~/.ssh/config: bash

    Host *
    AddKeysToAgent yes

    For macOS, add: bash

    UseKeychain yes

By following these steps, you can securely access your ruachost account using SSH keys for automated tasks or user file transfers without compromising security.