What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
What is Secure Shell (SSH) & How to  Secure WordPress with It?

What is Secure Shell (SSH) & How to Secure WordPress with It?

SSH, the short of Secure Shell, is one of the most reliable network protocol for remote login session and other network services. It is a valuable service supported by many trustworthy web hosting providers. However, many people just heard about it but are not familiar with its definition and usage. In the below part, we are going to explain SSH in detail and guide to manage WordPress securely with the service.

What Is Secure Shell (SSH)?

secure shellTraditionally, people communicate data online with Internet services like FTP, POP and Telnet. However, they are maturely unsafe because they send the username and password with plaintext, which is easily stolen by the man-in-the-middle. In this condition, Network Working Group creates a network secure protocol that communicates data online with encrypted information.

SSH connects through a secure channel in the insecure environment, transforming data between the server and a computer that runs an SSH server and SSH client. When communicating information through SSH, it will encrypt the transmitted data to prevent DNS spoofing and IP spoofing, which results in a secure transform. In addition, it compresses the data and accelerates the transmission speed.

Primarily, SSH is used to log into a remote server or computer and execute line commands. Running on both UNIX and Windows platform, it is also used as a replacement of Telnet or other unsecured remote shell protocols. Nowadays, people make use of the OpenSSH 2.x, which is free of charge and supports both 1.x and 2.x versions.

How to Secure WordPress with SSH?

secure WordPress with SSHAs a reliable protocol, SSH is widely used to manage online websites. In the following, we guide securely to transform WordPress sites with SSH. The management is quite easy and quick, only you should be familiar with the command lines.

First of all, you should back up the WordPress site in case any interruptions or problems. This step is required to do before any modification on your site.

Connect to your server via SSH. Of course, you should make sure the web host supports SSH; otherwise you need to transfer to a reputed one like BlueHost and HostMonster.

Connect to the root directory where your WordPress will be installed, and it usually has a wp-config.php file. Then follow the below instruction to start.

Install WordPress via SSH

Download the latest WordPress installation from the official site by executing the below code. The speed is fast, but all depends on your actual bandwidth.

downlaod wordpress code

Then, unzip the download file.

unzip the download file code

In the next, you can start to install WordPress, just like the general process, and we say no more again.

Update WordPress via SSH

First of all, you should also download the latest version of WordPress installation and unzip it. The command line is same as the above process.

Then, delete the wp-includes and wp-admin file.

delete file code

Access to the WordPress folder. Then, copy all files within the WordPress folder and paste them under the root directory, covering all existed data.

cover existed file code

Return to the root directory and delete the WordPress folder.

delete wordpress folder code

That is all. At present, you have updated your entire site with the latest version of WordPress and you can go to experience some new awesome functionality.

Transfer WordPress via SSH

It is typical and common to transfer your site to another server and hosting company. For example, you may annoy with the expensive renew price of the current host and want to transfer to a cheap WordPress hosting. With SSH, you can complete the process easily and quickly.

Log into the old server via SSH, and then export your database with mysqldump command. Remember to replace the databaseusername, databasename and backupname with your actual value.

export database

Execute the above code, you are required to enter your password and save the exported file. Then, you should copy the file and paste it under the root directory of HTTP server.

Go to the root directory and use the below code to package and compress all your files.

compress file

Log into your new server via SSH and unzip the package.

unzip file in new server

Log into your new MySQL server.

log into mysql server

If you haven’t created a database, you can now create a new one through your control panel or use SSH with the below code. Then, exit database and import your own database.

import database

At last, delete the compressed package and backup files. Everything is completed.


Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Very often, you could find her in various WordPress event as invited speakers.