How to set up SSH access to your Bluehost WordPress site

How to set up SSH access to your Bluehost WordPress site

You can set up SSH access by logging into your host cPanel and gathering some specific account info (like username, password and IP address) and and then using your terminal on your computer to connect.

TIP: SSH access requires first that you have a hosting account somewhere so if you haven’t yet got one you can search WordPress Hosting Plans before executing this tutorial.

View on YouTube

Why do you want SSH access to your WordPress Site?

Every now and then you will want to access your site from outside of the cPanel. Mainly I do this if

  • I have a git repository set up to track a plugin or theme
  • You can’t access your cPanel (to remove a plugin or theme via the File Manager) due to a bug or error or worse yet a hack
  • I have also done this in order to download really large databases files and also to download really large .zip files. Downloading large files this way can be much faster and less messy.

How to set up SSH access

Create the keys:

On your Terminal or Command Line (if you’re using Windows you’ll need OpenSSH), whichever name you prefer, copy and paste the below code. This will create a set of private and public keys with which SSH access is based on.

ssh-keygen 

This command will prompt you for some information.

  • First this command will ask the location you want to save the keys at. Just accept their suggestion unless you have a specific reason not to.
  • Second, it will ask you for a password. You can enter ‘no password’ simply by pressing enter at this stage but if you do want a password then enter it now. You will be prompted for it a second time in order to make sure its correct.
  • PROTIP: For most users I wouldn’t bother adding this password as you will be prompted for it each time you connect. Usually you forget it and its annoying to try remember but if you want an extra layer off security then feel free.

Add these keys to your BlueHost Account Dashboard:

  • Now, go to your Bluehost Dashboard. After you have logged in, go to the ‘Advanced‘ Tab which is also known as your cPanel in Bluehost parlance.
  • It will look something like the below in your dashboard.
  • Scroll down to the ‘SSH Access‘ Icon. Click into it.
The SSH Icon in your Bluehost Dashboard
  • Then click on the ‘Manage SSH Access‘ button.
  • Then click on ‘Import Key‘.
  • You will see a screenshot like below.
Importing the key you just created.
  • Now go back to your Terminal or Command Line and get the public and private keys.
  • Execute the below below to copy the public key.
cat ~/.ssh/id_rsa.pub
  • This will print to the Terminal screen the public key.
  • Carefully copy this and paste it into the ‘public key’ field in the Import Key Form you already accessed in your Dashboard.
  • Now run this code to get the private key (NOTE: this is slightly diff but similar to the above).
cat ~/.ssh/id_rsa
  • Paste this into the ‘Private Key’ field.
  • Add a name for it. For eg, the name of the computer your using so you know what device it works on in the future.
  • If you added a passphrase in the key creation process above then also add that same password here.
  • Save and you are ALMOST done.
  • IMPORTANT NEXT STEP!
  • Go back to the ‘Manage Keys‘ Page and find the key you just created in the list of Public Keys. Click the ‘Manage‘ Button.
This is the list of your public keys. Find your key and click the ‘Manage’ Button for that key.
  • You will now see an ‘Authorize‘ button. Click this and your SSH Key Generation on Bluehost is complete.

Use command line (terminal) to connect to your Bluehost Server:

Now you can learn to form the terminal command to connect to your Bluehost Account.

  • Go to your Bluehost Dashboards ‘Advanced‘ Tab.
  • On the right hand side you will need to copy the IP Address of your Bluehost Server and also the username. It will be under the ‘General Information‘ tab.
  • You will also need to know the password for your Bluehost Account.
  • NOTE: This IS NOT the password you created for the SSH key in the above process. It is the password you use to login to the Bluehost Dashboard itself.
On the right hand side of the Advanced Tab you will see the IP Address and User Name under the ‘General Information’.

You can now use this command in terminal in order to finally connect to your Bluehost Server.

ssh username@ipAddress
  • You’ll then be prompted for your Bluehost Account password.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *