Knowledgebase

Back to Security

How To Access My Account Using SSH


This article will assist you in gaining access to your Website through SSH. SSH is a secure way of transferring information (including files) between computers on a network.

Depending on the type of operating system you are using you will access your account with SSH differently.

SSH on Windows

If you're using Windows, you'll need to download an SSH Client to access SSH.

This guide uses PuTTY which is a free SSH client and can be downloaded here:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  1. Once you have downloaded PuTTY, search for and open PuTTY Key Generator (Puttygen) on your computer.
  2. Select Generate and move the mouse around in the gray box to generate some Randomness. This will generate a public key.
  3. Add a passphrase (password). This is what you'll need to put into the command line interface.
  4. Log in to StackCP, head to SSH Access from under the Security section.
  5. Then input the public key that was generated from PuTTYgen into the Public Key box. A handle will be generated automatically. Then select Add Public Key.
  6. Head back to PuTTYgen and select Save private key. Save this as any name you want.
  7. Open PuTTY. Down the left-hand side, select to expand the SSH menu and then select Auth->Credentials.
  8. Select Browse and add the private key you have just saved into "Private key file for authentication" .
  9. Head back to Session using the left-hand menu and add the host name. For the hostname use ‘ssh.us.stackcp.com’. Then, once that has been added, select Open.
  10. The command line interface will be shown. Then log in with your domain (e.g. domain.co.uk).
  11. You'll then be prompted for the passphrase that you set earlier. Enter this.
  12. You'll now have access to SSH for your site.

SSH on Mac OS

To connect via SSH on a Mac you can follow the instructions below:

  1. Select the SSH Access icon on StackCP.
  2. You’ll now need to generate a public key, on a Mac this is done via the Terminal utility. Open Terminal on the Mac.
  3. Enter the following command into the Terminal:
    1. ssh-keygen
  4. Press Enter
  5. You’ll be prompted to enter the location that you want the public and private keys saving. In this case, we’ll keep this as the default location. Press Enter
  6. You’ll be prompted for a passphrase, in this guide we’ll just leave this empty. If you enter one, make sure you remember this as you’ll be prompted for this later. Press Enter.
  7. You’ll be asked to confirm the passphrase, since we’ve left this empty just press Enter.
  8. Your keys will have been generated and the public key will have been saved in a specified location, in our example it has been saved in:
    1. /Users/Me/.ssh/id_rsa.pub
  9. Copy the path and enter the following command:
    1. cat /Users/Me/.ssh/id_rsa.pub
  10. The key will be outputted, copy the whole key from the start to the end.
  11. Paste the key back in StackCP in the Public Key field in the SSH Access section. The handle should be added automatically. Press Add Public Key. Please note that can take up to 5 minutes.
  12. Head back to Terminal and enter the SSH username and hostname found at the top of the SSH Access section, it should be something like domain.com@ssh.us.stackcp.com . You’ll need to prefix it with the ssh command as follows:
    1. ssh domain.com@ssh.us.stackcp.com
  13. You’ll be prompted to confirm you would like to connect, simply type yes and press enter.
  14. You should have successfully connected via SSH from your Mac to your hosting package

SSH with Google Authenticator
  1. Install Google Authenticator on your phone. You can find this app on the App Store or Google Play based on your phone/device.
  2. Login to StackCP and navigate Security -> SSH Access
  3. Scroll down to "Set SSH password" section and enter a strong password (Passwords should be at least 8 characters long using a mixture of upper/lower case letters with numeric and special characters) into "SSH Password" box then click "Set SSH password" button.
  4. Scroll down to "Google Authenticator" section and click "Set up authenticator" button.
  5. Open the Google Authenticator app that we previously installed on your phone. Click plus icon from the bottom right and select "Enter a setup key" (or Scan a QR code if you see the QR code on the page)
  6. Type a name into Account name box that remembers you this
  7. Enter "Your new secret key" into the "Your key" box
  8. Select "Time based" (which is default) from the "Type of key" dropdown box and click Add button from the bottom.
  9. Attempt to connect to SSH using your normal method
  10. The command line interface will be shown. Then log in with your domain (e.g. domain.co.uk) when you see "login as:"
  11. Enter the generated Google Auth code from your device when you see "Verification code:"
  12. Enter your SSH password you set earlier on the StackCP when you see "Password:"
  13. You'll now have access to SSH for your site.
 

Related Articles

Can I Use .htaccess To Password Protect A Directory
Can I Use The wget Command On A WestHost Server
Is A Dedicated IP Address Required For A Self-Signed SSL
Does WestHost Allow Sudo
Does WestHost Offer Protection Against Server Attacks

Can’t Find what you need?

No worries, Our experts are here to help.