Adding SSH keys to cPanel

  Print
If your server allows SSH access, most likely this will require an SSH key in order to authenticate. This is how you add an SSH key to cPanel.

SSH keys are used as a more secure authentication method for accessing a server over SSH. An SSH key consists of a pair of files. One is the private key, which you should never give to anyone. The other is the public key which will go on the server you wish to access. Whereas passwords are vulnerable to brute force attacks, SSH keys require you to authenticate with a private key which has the corresponding public key on the server.

If you don't have an SSH key already you will need to generate one to access your account / files over SSH.

Generating SSH keys on your Windows machine
You will most likely be using Putty to connect to the server through SSH (you can get that here: http://www.putty.org/ ).

Putty comes with a built in generator called PuttyGen. You can access this through:
Windows Start menu > All Programs > PuTTYgen.

Click the 'Generate' button to generate your keys. You can then save the Private key and the Public key to your local machine.

Generating SSH keys on your MAC (also works for Linux)

If you're using a MAC, you can generate an SSH key through a 'Terminal'.

1. Open up a terminal window and the following command:
ssh-keygen -t rsa

2. Press the ENTER key to accept the default location.

3. The ssh-keygen utility will then prompt you for a passphrase to password protect your key. You can also press Enter if you do not wish to password protect your key.

4. Your public key will be saved in /Users/myname/.ssh/id_rsa.pub. You can read this by running *'myname' should be updated*:
cat /Users/myname/.ssh/id_rsa.pub

Installing your Key on the cPanel Server
1. Login to your cPanel account for your domain.
2. Scroll down to Security and click SSH Access
f69f2888f37bfdadd34173effaff44d645906262?t=26c83f48f99ed27e9fc272ef93388016

3. Click Manage SSH Keys and then Import Key

5e109af84ea61c16603532f75a1706df5a58c24a?t=0c2019034e59488a6fb7413bd64ea0b8

4. From here, give your key a Name and paste in the Public Key and click Import

e6102d0351854b2d5f216a95b012f1cf24f15d5b?t=ce05f1abfbf23b43e1925bec97f8ac82

5. You should now see your key listed. Click Manage next to the key and click Authorize to allow access on this key:
f2331346cad1ab85949da6f4db17d2fb0e3752f3?t=d9d242599020128c8e5671d0e853cbfe

Once Authorized, you should now be able to connect over SSH using your Key.

Authenticating with your Keys

When connecting over SSH you will need to specify your cpanel user.

When connecting you will specify the user@server (e.g. huk@cpanel12.hostinguk.net).

If you are using Putty you can import your key into Pagaent (this is installed when you install putty). From here you can import your key which putty will use when you connect. This will need to be done each time you restart pageant or your machine.

If you are connecting through a terminal (i.e using Mac or Linux) then you can run the command:
ssh MyUser@ServerAddress

If you have any further questions, please contact support.


Related Articles

Login

 
Forgot password?
Register now

Language