How to enable SSH and add an SSH key (WHS panel and cPanel)

SSH gives you a command line on the hosting account: you start composer, wp-cli, git or npm, unpack large archives and do things that go slowly through the panel. The connection is encrypted, and the most secure way to log in is with an SSH key instead of a password.

1. Enable SSH

SSH is included in the client panel for both panels, and on WHS panel can also be done directly from the panel, with a button Activate SSH access (see WHS section below). It is available from the package Advanced and bigger ones. On smaller packages, the buttons are gray.

  1. Log in client panel and for hosting click Edit.
  2. Find a card SSH and click Activate. The change is immediate.
  3. You turn off SSH with the same card, button Deactivate.

2. Create an SSH key on your computer

On a PC (Windows 10 and 11 have this command in PowerShell, and Mac and Linux in Terminal) run:

ssh-keygen -t ed25519 -C "tvoj@email.rs"

You get two files: a private key id_ed25519, which you do not give to anyone, and the public key id_ed25519.pub, which goes into the panel. The key does not have to be created for each site, you can put the same public key on several accounts.

3. Add public key to panel

First, log in to your panel: in the client panel, under hosting, click AutoLogin Panel. In detail: Reset Password Panel or AutoLogin Panel.

What panel are you using? Click and go directly to your instruction.

Don't know which one you have? The WHS panel has a menu on the left (Control Panel, Domains, Email...). cPanel on the home page has icons arranged by groups (Email, Files, Databases, Domains) and the inscription cPanel at the bottom of the page.

WHS panel

SSH keys in the WHS panel

In the left menu, open Security well SSH keys.

Enabling SSH from the WHS panel

If SSH is not enabled, it says at the top of the page SSH access is disabled.. Click Activate SSH access and you can add a key right away. The same is achieved with the SSH tab in the client panel (step 1), one of those two is enough.

  • On the WHS panel, login goes only SSH key, never password, so you can't log in without an added key.
  • The same approach applies to SFTP (file transfer, e.g. in FileZilla with a key).
  • The session works in the isolated environment of your account: you only see your files.
  • While SSH is not activated, the server rejects the login with the key and reports only Permission denied. Do not try multiple times in a row, as failed logins may temporarily block your IP address.

How to add a key in the WHS panel

  1. Click Add SSH key.
  2. Key name: a recognizable name (for example My laptop).
  3. Public key: paste the entire content .pub file.
  4. Click OK.

In the table you can see the name, type and print of each key. You can register keys from multiple devices and remove any at any time.

Security: never paste the private key or share it with anyone. It goes exclusively to the panel public the key. If you lose a device, just remove its key from the table.

cPanel

SSH keys in cPanel

On the home page of cPanel, in the group Security, open SSH Access, then click Edit SSH Keys.

  1. Click Set the key, write the name of the key and paste the entire content of the file in the public key field .pub. Leave the private key field blank.
  2. Save, then return to the key list.
  3. In the table Public keys, at your key, click Edit and authorize it. The key only works when the status is authorized.

Generate new key generates a key pair on the server, but it is safer to generate the key on your computer (step 2), because then the private key never leaves your computer.

4. Connect

To connect you need the server address, port and account username. If you don't have them, ask support. In the terminal:

ssh -p PORT korisnik@tvojdomen.rs

On Windows, you can also use a program with windows, see How to SSH into Bitvise. If the server refuses the connection after several wrong attempts, your IP address is temporarily blocked. Please wait or contact support.