Creating a SSH Key to connect to your account

Your can create a SSH key to connect to your hosting account using the cPanel control panel. This key will serve a purpose of being an authorised remote connection to your account. This article explains how you can create a SSH key and then use this either on Windows 10 or Mac OS X to connect to your hosting account. * * * ## Create a SSH Key The first step is to log into your cPanel account. If you are unsure on how to do this, please view the following help article - '[How to log into cPanel](https://hostpresto.com/help/article/1)'. ![alt text](https://i.imgur.com/QRmld56.png "SSH key 1") * * * Scroll down to the '**Security**' section and choose '**SSH Access**'. ![alt text](https://i.imgur.com/sXtUf4o.png "SSH key 2" ) * * * Choose '**Manage SSH Keys**', ![alt text](https://i.imgur.com/jM13pcy.png) * * * Generate the new SSH key by choosing '**Generate a New Key**'. ![alt text](https://i.imgur.com/aLtbEYF.png "SSH key 3") * * * Type in a password for your SSH key into the '**Key Password**' and '**Reenter Password**' sections. You can also make use the of the 'Password Generator' if desired. ![alt text](https://i.imgur.com/sU4BtNr.png "SSH key 4") * * * Once the password has been entered, choose '**Generate Key**'. ![alt text](https://i.imgur.com/yXWBdJ3.png "SSH key 5") * * * The key generation is now complete. Choose '**Go Back**' to continue the process. ![alt text](https://i.imgur.com/ex2pigH.png "SSH key 6") * * * Under the '**Public Keys**' section, we can now see our new key. However, at the moment the '**Authorization Status**' is set to 'not authorized' which we need to change. We do this by selecting the '**Manage**' option. ![alt text](https://i.imgur.com/3sXfA44.png "SSH key 7") * * * Authorise the key by selecting the '**Authorize**' option. ![alt text](https://i.imgur.com/KENXfUX.png "SSH key 8") * * * The process will now confirm that the key is authorised. Select '**Go Back**' to continue the process. ![alt text](https://i.imgur.com/RfCAEW9.png "SSH key 9") * * * We now need to download the private key to the local system (the machine that you will connect to your account from). To do this, in the '**Private Keys** section, choose the '**View/Download**' option. ![alt text](https://i.imgur.com/M0WDhGl.png "SSH key 10") * * * Convert the key to PPK format by firstly typing in the password that you set earlier for your SSH key. Once entered, select '**Convert**'. This will then start a download on your system which is your private key. ![alt text](https://i.imgur.com/lYoriK7.png "SSH key 11") This key will need to be configured on your SSH application in order to successfully authenticate. If you are using Windows, put the downloaded '**id_rsa.ppk**' SSH key file in a secure folder on your system. * * * ## Windows 10 - SSH with the SSH Key This section explains how to SSH with a SSH key using PuTTY. If you do not already have PuTTY installed, please see '[Using SSH / SFTP](https://hostpresto.com/help/article/26/ "SSH key 12")'. Open PuTTY and type in: > * **Host Name (or IP address)**: You should type in your cpanel account name followed by @ then your server IP address i.e. youraccountname@yourserverIPaddress > * **Port**: Replace the SSH port numbered 22 to 4873 ![alt text](https://i.imgur.com/7XnOo5p.png "SSH key 13") *** Next down the left hand side, choose '**SSH**' followed by '**Auth**'. ![alt text](https://i.imgur.com/R2OxYg0.png "SSH key 14") Under '**Authentication parameters**', select the 'Browse' and then locate where on your system your SSH key is. Once found, double click it to return back to PuTTY. * * * On the left hand side, return back to the '**Session**' section where you were before. Select '**Open**' at the bottom. ![alt text](https://i.imgur.com/wWhxe6G.png "SSH key 15") *** If you are connecting for the first time, you may see a security alert. This is absolutely normal, so you should choose '**Yes**'. ![alt text](https://i.imgur.com/RlFmLh8.png "SSH key 16") *** The SSH connection should now be established. You have now successfully connected to your hosting account using your SSH key. ![alt text](https://i.imgur.com/eIXao9F.png "SSH key 17") * * * ## Mac OS X - SSH with the SSH Key Using Mac OS X, you will need to put the downloaded '**id_rsa.ppk**' SSH key file in '**/.ssh/authorized_keys/**'. Open your Launchpad and use the search at the top to type in 'terminal'. ![alt text](https://i.imgur.com/uCuVXku.png "SSH key 18") *** Click the Terminal application to open it. You should now see a command prompt. ![alt text](https://i.imgur.com/7sqBPsI.png "SSH key 19") If you've not yet moved your SSH key to the right folder on your system, you can do this by typing these commands with the respective replacement. ``` cd ~/YourDownloadFolder mv id_rsa.ppk ~/.ssh/authorized_keys/ sudo chmod 700 ~/.ssh sudo chmod 600 ~/.ssh/authorized_keys ``` Using sudo, you may be asked for your system password. *** Now that the SSH key has been moved and the correct folder permissions set, you will now need to load up your SSH key. ```sudo ssh-add -K ~/.ssh/authorized_keys/id_rsa.ppk``` This may again ask for the system password. However, it will ask the SSH key password that you set earlier. When entered, the SSH key will be loaded. *** You now need to connect to your hosting account. Use the following command with the appropriate replacements to connect to your hosting account. ```ssh youraccountname@yourserverIPaddress -p 4873``` For example, our account name is hpdemouk and our server IP from our account information email is 91.238.165.2. Therefore we would need to type in: ```ssh hpdemouk@91.238.165.2 -p 4873``` *** You should now be successfully connected to your hosting account via SSH on Mac OS X using your SSH key. ![alt text](https://i.imgur.com/7kYTtWV.png "SSH key 20") * * *
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to log into cPanel

There are two different methods to log into your cPanel control panel in order to manage every...

What's the difference between Aliases, Addon and Subdomains?

### Aliases An Alias domain does not have a unique website. It is a domain that is masked to...

Creating a MySql Database

If your website uses PHP or you need to hold a collection of records which need to be accessed...

Importing a MySql Database

You can import a MySQL database via phpMyAdmin which is available in the cPanel control panel....

Exporting a MySql Database

You can export a MySQL database via phpMyAdmin, available in cPanel, if you want to keep a backup...