Coding Agency for Web Development » Freestyle » How to Use SSH to Connect to Your WordPress Server?

How to Use SSH to Connect to Your WordPress Server?

READING TIME: MIN

As a developer, you’ll find that SSH is an essential part of your toolbox. You can use it to lay down state-of-the-art environments, tweak websites, automate run-of-the-mill tasks on WordPress, or as a failsafe to access your site. Let me walk you through what is meant by SSH and how you can use it to connect to your WordPress server.

A Beginner’s Guide to SSH

SSH or “Secure Shell”, according to ssh.com, “is a method for secure remote login from one computer to another”. Or to put it simply, it lets you log in to a server and avail of its services.
You’ll need an SSH client and credentials to login via SSH.

SSH Clients

If you have a Mac or a Linux box, you’re set to get started with SSH from the terminal itself. For the folks with a regular old Windows machine, the SSH client comes into play – the popular choice being Putty. Read on to find a simple Putty tutorial so you can hit the ground running.

Login Credentials

Your credentials for an SSH login are comprised of at least the server details, your username, your password, and the port for login. The server address can be either your domain name or IP address, and the port only needs to be specified if you’re not using the default port. Here are examples of terminal commands for SSH login:

  WP All Import released wp-cli integration

ssh [email protected] -p 22

Putty Setup –  for Windows users

As mentioned above, this is for Windows machines, so the Mac and Linux people can skip right over this Putty tutorial.

Download Putty, run the program. Once the application screen has loaded up, paste your server address into the field named ‘hostname’. If you have a port number, enter it in the field next to the hostname, set the protocol to SSH, and click on ‘Open’ at the bottom right.

There should now be a new window that resembles a Linux terminal or a command prompt. When prompted, enter your username, and then your password. In just a bit, you will be logged in to the server. You might get notifications about such things as RSA fingerprints; click OK and proceed.

Using the Terminal to Connect through SSH – Mac and Linux users

Needless to say, Windows users don’t need to read this once Putty is setup, so skip on over.

This is a simple process: open terminal, enter the command. The command itself, as we’ve seen before, is in the form:

ssh username@servername <-p port number>

As seen before, the port part of the command is optional. Enter your actual credentials above, press Enter, enter the password when prompted for it, and log in. Any notifications you receive about RSA fingerprints or other such things can be agreed to by pressing Enter or entering “y” (for yes) to proceed.

  Friends in the WordPress Universe

Those of you who did not heed our suggestion to skip one of the sections will now be enlightened with the knowledge that both processes are essentially similar. From here on, it will be identical.

SSH Commands

You can now enter a whole bunch of SSH commands, just like on the regular terminal or command prompt. The thing to remember is that with great freedom comes great opportunities – including the possibility of screwing up something irreversibly.

You may end up deleting or stopping something essential or important. So make like Peter Parker, use SSH responsibly, and you should be fine. Congratulations, you are now an SSH WordPress ninja.

In Part 2: WP-CLI and what it can do for you

WP-CLI is a CLI (Command Line Interface) for WordPress and there are all sorts of cool tricks up its sleeve. In the next part, we’ll see how you can install it, and use it to connect to your server with SSH.

Tags:

Vipe Team

Author Vipe Team

Our tireless team who creates high-quality WordPress-related content for you 24/7/365.