Explaining SSH and the importance of using it for WordPress website owners

There are several ways through which you can communicate with your website on the hosting server in order to manage and control it, and one of these secure ways is through the Secure Shell (SSH) protocol that is supported by some hosting plans.

In this article, we will talk in detail about the concept of SSH, how it works, and when it is useful on a WordPress website, and then we will explain in detail the steps to connect to your website via this protocol using the PuTTY application.

What is SSH and why is it used?

The term SSH  is Secure Transfer Protocol and is an abbreviation for Secure Socket Shell or  Secure Shell , which is a network protocol similar to the File Transfer Protocol ( FTP) that enables you to edit the basic files of your site, but this protocol provides you with greater capabilities as it enables you to Connect to your website’s hosting server and make the changes you want to it directly, and this is not possible through the FTP protocol.

The SSH protocol does not have a graphical interface. Rather, it has a command line interface through which you can have full access to your server settings. Therefore, you must have knowledge of how to set up SSH to connect to your site. You must also have knowledge of the basic command line instructions and the commands that you will need to interact with the server. And how to implement the various adjustments and procedures you need.

What is command line?

A command line is an interface that allows you to perform tasks by running commands through written text, rather than through graphical interfaces (GUIs) in which most tasks are performed by clicking mouse buttons.

The SSH protocol gives users a high degree of control over the hosting server, provides them with a direct connection to the server, gives them full access to its settings, and enables them to interact with the site and its files in a quick and direct way.

For this reason, you will not find the feature of accessing the site through the SSH protocol available in all hosting plans, especially shared or managed hosting plans, for security reasons and to protect against any wrong or inappropriate modifications that users may make to the server settings.

While hosting such as dedicated server hosting, which provides a private server for the site, and virtual dedicated server (VPS) hosting usually provide subscribers with direct access to the server via the SSH protocol.

Read more: What is Web Hosting? And what are its types?

To find out whether your host provides you with this feature, you must check the details of your plan or contact the hosting technical support to obtain the set of data necessary to connect to the server using SSH, which is:

  • IP address or what is known as Server IP
  • user name
  • password
  • You will also need to install a terminal application or SSH client on your local computer to connect to the remote server.

When do I use SSH to connect to a WordPress site?

Actually, there are several ways through which you can access, interact with, and control your remote website, and you can choose from among these methods what suits you to control your site.  

  1. Connect to the site and control it through the site admin control panel (WordPress Dashboard) provided by the WordPress system by default.
  2. Connect to the site through the hosting control panel (Web Hosting Control Panels), as most hosting companies provide their own control panels through which you can connect to the site and control it, such as cPanel , Plesk,  and other alternatives .
  3. Connect to and manage your site through an FTP client application such as FileZilla. Through the FTP protocol, you can  access, edit, download, and upload additional site files to your site.
  4. Finally, you can connect to your site through the SSH protocol, which is similar to the FTP protocol but provides a greater degree of control and interaction with your site files and with the hosting server using the command line.

And if you are wondering when do I need to use the SSH method to connect to my site?

The answer is: If you are a WordPress developer and you want to interact directly with your website server and control it completely, make updates, run development tools such as ( Git , Composer, and WP-CLI) for your WordPress site, or query the database using SSH, etc. This is one of the advanced tasks on the site.
But if you are a regular website owner and not concerned with matters of controlling the precise technical details of your website, then you probably will not need to use this method to communicate with your website server, unless you want to raise the level of management of his website and control it more through the command line interface.

Is SSH secure?

Yes, the SSH protocol is considered one of the secure ways to access remote resources. SSH provides password-based authentication (or public key to ensure greater protection), and it also encrypts communications between the client and the server using strong encryption algorithms to ensure the privacy and integrity of the data that is exchanged. between two sides.
So SSH is a secure alternative to older login protocols such as telnet, rlogin, and FTP.

However, you must be careful – if there is more than one user of the site – not to give SSH access data to any user of the site and to give it only to users whom you trust and who actually need it to deal with the site.
Because the user who has SSH access to your server will, as we mentioned, have full control and will be able to access all files, copy them to his own device, delete them from your device, and other powers… so be careful and do not grant them to any user.

Steps to connect to a WordPress website via SSH

In this paragraph, we will explain the steps to connect to the server of your WordPress site using SSH.

Step1. Get SSH access data  

First, you must make sure that your hosting supports SSH access, and you have the SSH access login information that the hosting company gives you. For example, if you use Cloudwise cloud hosting to host your WordPress site, you have SSH access by default.

You can access your SSH access data by logging in to your account page on the Cloudwise platform, choosing Servers from the top menu of the page, selecting the server you want to connect to, then from the Server Management section,  choose  the Master Credentials
tab . From this tab you can find The following data for SSH access (Public IP, Username, and Password). Copy this data and save it in a safe place because you will need it in the following steps.

SSH  Access

Step2. Install a terminal application or SSH client on your computer  

In order to connect to your website via SSH from your local Windows computer, you need to download a terminal application or an advanced command line application on your computer (such as Cmder, which is more advanced than the built-in Windows cmd and supports SSH instructions). .

Or you can download any custom SSH client application on your local machine such as PuTTY, OpenSSH, Mobaxterm, Bitvise SSH Client or other available options.

You are free to use any suitable application that allows you to manage your site, but in our current article we will rely on the PuTTY application, which is considered one of the oldest and most famous SSH client applications and is an easy, simple, and open source application.

note

If you are using the Linux operating system, you can rely directly on the system’s built-in command line terminal to access the site via SSH, and you will not have to install any additional application on your device.

To install the PuTTY application on your computer, all you have to do is go to the official page of the application and download the latest version compatible with your operating system.
 You can download the application in msi format to your local device, and then install it as you would install any normal application.

Or you can download it in exe format to run it directly after downloading it to your device.

Step 3. Access your server via SSH

Once you have finished installing and running the PuTTY application, you will be asked to enter the host name or IP address of your server, and here enter the address that you obtained from the hosting control panel as we explained in the first step, and you will be asked to specify the port number (leave it at the default value of 22).

You will notice that the PuTTY application does not initially ask you for the rest of the data (username and password), but it will ask for it shortly. After you enter the required data, click the Open button at the bottom as shown in the following image:

The application’s command line window will then launch and your server will ask you for other SSH access information (username and password).

After the successful connection process, you will now be in direct contact with your WordPress site server and you can control it as you want and start writing any commands you want the server to execute so that it can execute them for you immediately.

Note:
You can copy the username from Windows and paste it into the PuTTY terminal by placing the mouse cursor where you want and right-clicking or by pressing the Shift + Insert keys on the keyboard.

Step 4. Execute server control commands

If you have used command line instructions before, dealing with the PuTTY terminal will be easy and straightforward, as you will be able to do almost anything you want from the server, such as creating new files or folders, moving between them, changing member permissions, and much more… and all This is done by typing text commands in the terminal. All you need now is to know all the SSH commands you can execute and how to use them correctly.

For example, after logging directly into your server via SSH, you are supposed to be located in the root folder of the server, and if you want to know which files and folders are located in this server, all you have to do is type the ls command and press the Enter key to see the result. In text form as follows:

As you can see in the following image, here, as a result of executing the command, one application name appears in green blue (indicating that this is the root folder of the server), and the names of the rest of the folders will appear in blue, while the names of files of different types will appear in white.

To enter this folder, you must use the cd applications command, and to return again to the root folder, you must type the cd command without any additions after it.

These are just simple examples of what you can do from the application terminal. Below is a table of the most important SSH commands that you can use to interact with the server.

The command the mission
cd Abbreviation for change and it is used to change the current directory and move to another directory
ls  Shortcut for the list command, which displays all the contents of the current directory
pwd This command shows you the current location or path you are in.
mkdir  Short for make directory which is used to create a new directory in the existing directory.
touch  Used to create a new file
cp Copy command
mv  Move command
cat  To display the file content on the screen
zip To compress a file
find To search for a file within the directory
clear To erase everything written on the terminal

Of course, there are more complex instructions through which you can perform more complex tasks. For example, through the following tutorial in the terminal, you can create a backup copy of your site’s database and upload it to your local device in the form of a dbname.sql file.

mysqldump -p -u username database_name > dbname.sql

Of course, you must enter your username and database name when calling this command.

If you want to know the most important commands for interacting with your server using SSH, you can refer to them through the following reference or any other reference you prefer, and do not forget to be careful before applying any of them to your actual server so as not to cause the site to crash as a result of implementing Any order incorrectly.

Conclusion

In this article, we explained the concept of the SSH protocol and when it is used. We explained in detail the steps for using it to connect to a remote WordPress site. We also explained that it is considered a very fast and secure way to connect to your server through the command line interface.

In conclusion, remember that you must be careful in using SSH access for your WordPress site, and grant access to the site through it to expert and trusted users only. Otherwise, it is better to limit access to the site through the admin control panel, hosting control panel, or FTP client.

Avatar photo
I am a young man who has been working in WordPress and e-marketing for 10 years. I would like to share my experience with you so that we can become professional in WordPress I will be happy to share the experience with you.