How to login to WordPress Hosting using your SSH key

Applies to:
WordPress Hosting

Difficulty:
Easy

Time Needed:
5 minutes

Introduction

This is a quick step-by-step walkthrough for logging into your WordPress Hosting container via SSH.

Before you start using SSH, you will need to create a private and public keys. For more information on creating SSH keys, please read our Knowledge Base article 'How to create an SSH key'.



Logging into your WordPress Hosting container


Step 1

Configure SSH access to your account

Shell access to your account uses the same details as FTP, so you may need to follow our guide on 'How to Manage Your FTP Access Details', in order to update your password. You will also need to unlock your FTP account before you can SSH into your container.

Configure SSH access to your account

Step 2

Connect to your account using SSH

You will need to connect to your account using SSH in order to access WP-CLI. Exactly how to do this will depend on the operating system that you are using.

Windows
You should use a client such as PuTTY.

Mac OS X
The ssh command is available from Terminal (Applications > Utilities > Terminal).

Connect to your account using SSH

Step 3

Login via SSH

Once you have unlocked STP, login into your WordPress Hosting container using your SFTP username and your container's IP address.

ssh johnsmith@80.80.1.1

You may then receive a connection authenticity warning. Type 'yes' and hit return to continue.

When prompted, enter your SFTP password to login.

Login via SSH

Step 4

Create a new folder called '.ssh'

Then you'll need to create a new folder called '.ssh'. To do this, simply enter the following command.

mkdir -p /var/www/vhosts/yourdomain.com/.ssh

Please note: Replace yourdomain.com with your own domain name.

Create a new folder called .ssh

Step 5

Set permissions on your '.ssh' folder

After the folder has successfully been created, you then need to set the folder's permissions. To so this, simply enter the following command.

chmod 700 .ssh

Set permissions on your .ssh folder

Step 6

Create a new file called 'authorized_keys'

Then you'll need to create a new file called 'authorized_keys' inside your '.ssh' folder. To do this, simply enter the following command.

touch .ssh/authorized_keys

Create a new file called .authorized_keys

Step 7

Set permissions on your 'authorized_keys' file

After the file has successfully been created, you then need to set the files's permissions. To so this, simply enter the following command.

chmod 600 .ssh/authorized_keys

Set permissions on your '.authorized_keys' file

Step 8

Add your public key to the .ssh/authorized_keys file

You then need to copy and paste your key into your 'authorized_keys' file. Firstly, copy your private key to your clipboard. Then enter the following command.

vim .ssh/authorized_keys

Press 'i' key on your keyboard, go to into insert mode. Then paste your key into the editor provided.

Then press the escape key on your keyboard, go exit insert mode. Finally, type the following command to write your changes and quit VIM.

:wq

Add your public key to the .ssh/authorized_keys file

Was this helpful?

   
4 people found this article helpful
34SP.com Rated 9.2 out of 10 based on 172 reviews Trust Pilot