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.


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).


STEP 3
Login via SSH

Once you have unlocked STP, login to 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.


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.


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


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


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


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 public 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 ESC on your keyboard, go exit insert mode.

Finally, type the following command to write your changes and quit VIM.

:wq

Was this article helpful?
YesNo