Whether you’re trying to run a Bash script, have a look at what processes are running or just move files around, you need to get to the terminal / command prompt on your web hosting plan. Most of the best web hosting plans give you access to the Linux terminal, but require you to use an SSH (Secure Shell) connection to log into it from your PC.
In order to connect from your computer via SSH, you need to first create a public / private key combination and download the private key file. Then you can use both the private key file and a passkey (aka password) in an SSH client such as Putty to establish the connection. Below, we’ll show you how it’s done.
How to SSH to your web hosting server
Note that these instructions assume that your web hosting plan uses cPanel as its control panel. Some plans use other control panels which will have similar, but not identical interfaces.
1. Navigate to your control panel and log in. Usually, the control panel type is cPanel and the login is at https://www.yoursite.com/cpanel.
2. Click SSH Access.
3. Click Manage SSH Keys.
4. Click Generate a New Key.
5. Give the key a name (“id_rsa” is usually the default) and enter a password. Then click Generate key.
6. Click Go Back.
7. Click Manage next to the Public key.
8. Click Authorize and then Go Back.
9. Click View/Download next to the private key.
10. Click Convert under Convert to PPK format. If it’s not automatically filled in, you will need to enter the password you used to create the key.
11. Click Download Key.
A PPK file downloads to your computer. Store it somewhere where you won’t lose it.
12. Launch Putty. Download and install it if you don’t already have it installed.
13. Enter the hostname and SSH port number. You’ll get these from your provider. If you have your own domain the hostname would be your domain name.
14. Under Connection->SSH->Credentials, click the Browse button under Private Key file and select the PPK file you downloaded.
15. Optional: save your hostname. Under the Session tab, give your session a session name (ex: “mysite”) and hit Save. This will allow you to load the hostname and path to the PPK file. So next time you open Putty, you can hit the sitename and hit load.
16. Click Open.
17. Click Accept if prompted. This happens the first time you log in to a new site.
18. Enter your username and passphrase. The username is the same one you used to log into cPanel, but the passphrase / password should be the one that you used to create the public / private key.
You should then get the terminal prompt. Save the PPK file because, if you have it, you don’t need to recreate it, each time you want to connect, just the first time.