Log in to your hosting over SSH (key or password)
SSH opens a secure command line on your hosting, to handle files or run tools without going through the browser. You log in with your cPanel account's password or, more safely, with a key.
Before you start
- SSH access is not always open. cPanel states that not every hosting provider allows shell access: it depends on your plan and on what your hosting provider has enabled for your account. If it is missing, contact support before going further.
- You need three pieces of information: your cPanel username, its password (see Log in to cPanel), and the server address and SSH port number of your hosting. The last two are not the same everywhere: if you do not have them, ask support. In the examples below, they are
PORTandSERVER-ADDRESS. - On Windows 10 or 11, use Windows' OpenSSH client (an optional feature named OpenSSH Client, to add in the settings if it is missing) or software such as PuTTY, which cPanel mentions in its documentation. macOS and Linux include the
sshclient. - A shell on shared hosting is often restricted (cPanel speaks of a "jailed shell", an environment that limits certain commands): that is normal.
- The labels below come from cPanel's official documentation, in English; the French version of your cPanel may translate some of them.
Steps
The simplest option: cPanel's Terminal
- In cPanel, open Advanced › Terminal.
- Read the warning, then click I understand and want to proceed (it only shows the first time).
- A terminal opens in the browser, already connected to your account: no software, no address or port to enter.
The Terminal only appears if you have shell access and your hosting provider has enabled the SSH Access & Terminal feature. If you log out of cPanel, its sessions close after a short delay; running commands continue until the session closes.
Log in with a password (macOS, Linux, Windows)
- Open a terminal: the Terminal app on macOS or Linux, PowerShell on Windows.
- Type the following command, replacing the three values, then press Enter:
ssh -p PORT USERNAME@SERVER-ADDRESS - Enter your cPanel account's password. Nothing shows while you type: that is normal.
- A command prompt appears: you are logged in. To leave, type
exit.
With PuTTY: open PuTTY, enter the server address in Host Name (or IP address) and the port in Port, select the SSH protocol, click Open, then enter your cPanel username and its password.
Log in with a key (safer)
An SSH key is a pair of files: a private key that you keep on your computer, and a public key installed on the server. With it, there is no password to enter (or only the key's passphrase).
A. Create the key in cPanel
- In cPanel, open Security › SSH Access, then click Manage SSH Keys.
- Click Generate a New Key.
- If you choose a custom name in Key Name, note it down: you will then have to specify the key when you log in. The default name is
id_rsa. - Enter and confirm a password (the key's passphrase), choose the key type and size, then click Generate Key.
- Authorize the key: in the public keys table, click Manage next to the key, then Authorize. A key that is not authorized does not work.
- In the private keys table, click View/Download and save the private key on your computer. Never share it.
B. Log in with the key
On macOS, Linux or Windows (PowerShell):
ssh -p PORT -i PATH/TO/THE-KEY USERNAME@SERVER-ADDRESS
Enter the key's passphrase if you set one (otherwise press Enter).
Variant: create the key on your computer. The ssh-keygen command (OpenSSH) creates a key pair; with no option it generates an Ed25519 key. The public key (the .pub file) is to be added to your account's .ssh/authorized_keys file, as cPanel's documentation describes for PuTTY. Keep the private key on your computer.
Expected result
A command prompt appears, with your username and the server's name. Type pwd: the answer is your home directory, in the form /home/username. You can then use the commands described in Basic Linux commands.
If something goes wrong
- "Permission denied": the username or password is wrong, or shell access is not enabled on your account. First check that you can log in to cPanel with the same credentials, then contact support.
- "Connection refused" or "Connection timed out": the address or port is wrong, or the service cannot be reached from your network (some company networks block SSH). Check these two values with support.
- The key is refused: check that the key is authorized (status in Manage SSH Keys), that you point to the key with
-iif its name is not the default one, and that its passphrase is correct. - cPanel's Terminal is missing: you do not have shell access, or your hosting provider has not enabled the feature. Contact support.
- A command is not found: the environment is restricted (limited shell). See Basic Linux commands.
FAQ
Does my hosting allow SSH?
It depends on your plan. If the Terminal shows up in cPanel, or if the SSH Access page is present, the shell is available; otherwise, ask support. Full access to a server is mostly what a VPS is for.
What is the difference between SSH, SFTP and FTP?
SSH opens a command line. SFTP is a file transfer that goes through the same kind of encrypted connection; classic FTP is not encrypted (see Create additional FTP accounts).
Key or password?
The key is safer: it cannot be guessed like a password, and you can revoke it by deauthorizing it (Deauthorize).
How do I revoke a key?
In Security › SSH Access › Manage SSH Keys, click Manage next to the key, then Deauthorize. It can no longer be used to log in. Delete Key removes it.
Related articles
- Basic Linux commands and absolute paths for your hosting
- Log in to cPanel: address, credentials and a tour of the interface
- Create additional FTP accounts in cPanel
- Use cPanel's File Manager
Need full access to your server? Discover our virtual private servers (VPS).