Set up an SSH connection without a password

This guide will show you how to connect to your server via SSH from your designated computer using PowerShell and cPanel without a password.

SSH keys are one of the most secure SSH authentication options. It is more secure than the usual SSH password authentication. I recommend using SSH key authentication to connect to your servers.

Generate a private-public key pair on your local computer
  1. Type in this command line in your PowerShell terminal. $ ssh-keygen -t ed25519 -C [email protected]
  2. When asked to Enter passphrase (empty for no passphrase), press Enter
  3. Navigate to the .ssh folder under your home directory. Observe there are now id_ed25519 and id_ed25519.pub files. These are your private and public keys respectively.
  4. Copy your public key content to your clipboard by typing $ cat id_ed25519.pub in your terminal.
Import your public key to your server
  1. Login to your server and paste your computer public key by following these steps. (This is the last time you will need to enter your password. By uploading your computer’s public key to your server eliminates the need for a passphrase when connecting through SSH).
  2. Navigate to the SSH option on your server’s cPanel control panel.
  3. Click the Manage SSH keys button.
  4. Hit the Import key button.
  5. Choose a name for the key e.g. “ed25519”.
  6. Paste the public key you copied earlier into the designated text box.
  7. Click Import to complete.
  8. Authorized the public key by selecting Manage > Authorize
Connect to your server via SSH
  1. Now return to your local computer terminal.
  2. Connect to your server through SSH by typing (replace with your username and your server’s IP address or domain) $ ssh [email protected]
  3. Press Enter when asked to enter a passphrase.
  4. Now you can login to your server via SSH from this specific computer without a password.

Leave a Reply

Your email address will not be published. Required fields are marked *