Adding an SSH public key to a cPanel account

An SSH public key lets an authorised computer authenticate without sharing the hosting password. Keep the private half on the trusted client when setting up inbound access; only the public key needs to be authorised on the hosting account.

Check access and requirements

Confirm the service includes shell or SFTP access and obtain the actual hostname, port and username. Generate a modern supported key on the trusted client, protect its private key with an appropriate passphrase and record its fingerprint.

01 Add an SSH public key to a cPanel account

  1. Open SSH Access > Manage SSH Keys in cPanel and choose Import Key.
  2. Give the key a descriptive name and paste the public-key line into the public-key field. Do not upload the client’s private key merely to allow inbound login.
  3. Import the public key, then use its Manage action and choose Authorize. An imported but unauthorised key will not grant access.
  4. From the trusted client, connect using the correct username, port and private-key file. Verify the server host-key fingerprint through a trusted provider source before accepting it.
  5. Test a harmless command or SFTP listing and document the key’s owner and intended lifetime. Keep the existing recovery method until the new access is verified.

02 Example: connect with your authorised key

On a trusted computer with OpenSSH installed, replace the key path, SSH port, cPanel username and hostname below with the values for your service. The path points to the private key on your computer.

Code or configuration example
ssh -i /path/to/private_key -p SSH_PORT CPANEL_USER@SSH_HOST

-i selects the identity file and lowercase -p selects the server port. Verify the server host-key fingerprint through a trusted support or service record before accepting a new host. A prompt for the key passphrase unlocks your local private key; it is different from a hosting-account password prompt.

Once connected to a shell-enabled account, run pwd and id to confirm the location and account, then use exit to disconnect. If the client falls back to another login method, investigate the selected key and its authorization before treating the test as successful.

Confirm the expected result

The key should authenticate to the correct hosting account and provide only the access included with that service. It does not grant root privileges.

Resolve setup problems

If authentication fails, check authorization status, the selected private key, username and shell eligibility. Do not repeatedly paste private material into support chats. A lost or exposed key should be revoked and replaced.

Can several people share one key?

Use a separate key for each person or automation task where practical. This makes revocation and attribution clearer and avoids replacing everyone’s access when one device is lost.

  • 0 Users Found This Useful
  • cpanel-whm, development
Was this answer helpful?

Related Articles

Uploading website files with cPanel File Manager

File Manager is useful for a small deployment or a single file change without installing an FTP...

Creating files and folders in cPanel File Manager

Create a folder to organise website assets or a file for a specific application task. An empty...

Editing a text file in cPanel File Manager

File Manager can make a focused change to a website text or configuration file. Saving writes...

Finding and editing .htaccess in cPanel

The .htaccess file can control redirects, access restrictions and application rewrite rules on...

Creating a restricted cPanel Web Disk account

Web Disk provides WebDAV access to server files. An additional Web Disk user can manage a...