# Accessing your account using SSH keys

> Create an SSH key pair and use it to log in to your hosting account securely without typing a password.

Source: https://helpcenter.ruachost.com/getting-started/your-account/accessing-your-account-using-ssh-keys-in-ruachost/

SSH (Secure Shell) keys provide a secure and convenient way to access your Ruachost hosting account without typing your password every time. They can also be used to set up automated processes or add an extra layer of security with two-factor authentication.

## What Are SSH Keys?

SSH keys are a pair of cryptographic keys used for authentication:

- **Private Key** – stays on your local computer and should never be shared.
- **Public Key** – uploaded to your Ruachost hosting account.

When you connect, the server checks that your private key matches the stored public key, allowing you to log in securely.

## Why Use SSH Keys?

- **Passwordless Login** – no need to type your password each time.
- **Automation** – run scheduled tasks (like backups) without manual login.
- **Security** – stronger than passwords alone, especially when combined with a passphrase.
- **Team Access** – grant developers or collaborators secure access without sharing your main password.

## Generating SSH Keys

You’ll first need to generate a key pair on your local computer.

### On Windows (10/11):

1. Open **Command Prompt**.
2. Run:

   ```bash
   ssh-keygen
   ```
3. Press **Enter** to accept the default save location.
4. Optionally, set a passphrase for extra security.
5. Your keys will be saved in the `.ssh` folder (e.g., `id_rsa` and `id_rsa.pub`).

   ### On macOS/Linux:

   1. Open **Terminal**.
   2. Run:

      ```bash
      ssh-keygen -t rsa
      ```
   3. Press **Enter** to accept the default save location.
   4. Optionally, set a passphrase.
   5. Keys will be saved in `~/.ssh/`.

      ## Adding Your Public Key to Ruachost

      1. Log in to your Ruachost CPanel.
      2. Navigate to **Security Settings → SSH Access**.
      3. Open the **authorized_keys** file or use the panel’s SSH Key Manager.
      4. Paste the contents of your **public key** (`id_rsa.pub`).
      5. Save changes and ensure correct permissions are set:

         ```bash
         chmod 700 ~/.ssh
         chmod 600 ~/.ssh/authorized_keys
         ```

         ## Connecting with SSH Keys

         Once your key is added, connect using your private key:

         ```bash
         ssh username@yourdomain.com
         ```

         - Replace `username` with your Ruachost account username.
         - Replace `yourdomain.com` with your domain or server IP.
         - If using a custom port, specify it with `-p`, for example:

           ```bash
           ssh -p 7822 username@yourdomain.com
           ```

         If you set a passphrase, you’ll be prompted to enter it. Otherwise, you’ll log in automatically.
