Connect with us


SSH Beginner’s Guide for WordPress Users and Everyone Else



SSH Beginner’s Guide for WordPress Users and Everyone Else

Running a WordPress site often involves a lot of time-consuming maintenance tasks. Updating WordPress, deleting or adding files, checking the database; for every little thing you have to go log in to the WordPress dashboard. In this beginner’s guide to SSH, you will learn how the secure shell access can make your life a lot easier.

SSH allows you to securely and remotely access your server through the command line. What used to take minutes of clicking around in the back end you can now do in seconds just by typing in a simple command.

Ready to try it for yourself? In this post, we’ll teach you all about SSH, help you connect to your site, and show you some basic commands to get started.

What is SSH?

Accessing remote computers needs to be handled carefully. Imagine if just anyone could log into your WordPress server and execute commands. While protocols like FTP exist, they’re both not very secure and don’t allow you to do much more than transfer files.

filezilla ftp client for wordpress

SSH is the solution: the ability to access your server right from your desktop and run remote commands to control it. It’s powerful, it’s secure, and it’s extremely convenient for developers.

Thanks to the secure shell layer, no one can easily listen in on what you’re doing, or intercept your connection to send commands of their own. That’s vital when you’re performing sensitive operations, like looking at hidden folders or downloading files onto your server.

SSH simplified protocol diagram
Image source:

How it works is simple: Your site’s host computer runs an SSH server that waits for requests. You can connect to it using an SSH client on your PC, if you know the address of the server. With a username and password, the connection opens and you’re free to type in terminal commands.

The straightforward nature of SSH makes it much faster than logging into WordPress or even using an FTP client. Therefore, if you’re often moving around files, managing WordPress tasks, or constantly performing other server maintenance duties, it’s definitely worth a try.


You may be thinking to yourself: This sounds familiar. Isn’t connecting remotely to your site just FTP?

SSH is just one of several ways of connecting remotely to a website. FTP, FTPS, SFTP, SSH, FTP over SSH all do generally the same thing, but each has a different way of going about it.

FTP/FTPS, SFTP, and FTP over SSH all have one thing in common: they’re made primarily for file transferring. FTP is the most basic version of this idea, and operates on an insecure network, while FTPS is a secure version of the same protocol. FTP over SSH uses an SSH tunnel between the FTP client and the server. And SFTP is just an SSH protocol with file transfer capabilities.

Image source: WP Engine

Besides FTP being unencrypted, there’s no major drawbacks to any of these; they all have different use cases. FTP and its derivatives should be used when you need to transfer files, while SSH is helpful for executing remote commands. It is worth noting that SFTP is generally considered more secure than FTPS or FTP over SSH.

Who Can Use SSH?

Whether or not you have access to SSH all depends on your host. Some are more restrictive than others; SSH gives you access to sensitive commands, and it’s easy to break your website if you don’t know what you’re doing, so not every host will offer SSH access. Shared hosting plans in particular aren’t likely to have it, or key features may be disabled.

Not sure? Email your web host or check your plan’s features. You may either have SSH access or the ability to install it. Even if you purchased unmanaged hosting, or are running your own server, you could still install OpenSSH yourself.

Otherwise, there are no special system requirements to install or connect to SSH, but you should be familiar with managing servers before trying to set it up on your own.

How to Connect to WordPress Over SSH

SSH might sound like this huge complicated thing, but it’s actually quite simple to get into, especially if it’s already installed on your server. It’s just a matter of getting your credentials, launching a terminal, and connecting. That’s what we will talk about next in this SSH beginner’s guide.

Getting SSH Credentials

Before you’ll be able to connect to your site, you’ll need to obtain SSH credentials. If you’ve used FTP before, it’s a very similar process.

Login to your web host’s dashboard. Look for a section labeled “SSH Credentials”, “Access”/”Root Access”, or something similar. If you can’t find it, check your host’s documentation or email them asking for your SSH connection info.

ssh beginners guide ssh credentials

If you set up SSH yourself on an unmanaged server, you should have written down the credentials you set. In case you lose them, some SSH programs include password authentication. Or your host may allow you to reset them through the back end.

Once you’ve gotten your username, password, connection address, and port, you’re ready to connect. Yet, make sure to back up your website first, as it’s possible to break it if you don’t know what you’re doing.

While some hosts come with a console built into their back end that lets you run SSH commands, you’ll likely be using the built-in terminal on your Mac or Linux installation, or installing a program if you’re on Windows.

Connecting with Mac or Linux

For users running UNIX-like operating systems — MacOS or Linux — connecting to SSH is easy. You don’t need to download any external software or activate anything; just use the Terminal that comes preinstalled.

  • Mac users: Either click the Launchpad icon in the Dock then search for “Terminal”, or open the Finder and go to Applications > Utilities and click to launch the Terminal.
  • Linux users: Just open the applications menu and launch the Terminal.
ssh beginners guide open terminal on mac

You should see an empty console appear on your screen. To connect, type the following command: 

ssh [email protected]

Replace username with your SSH credentials and the example URL with the SSH server’s IP or address.

You’ll probably be connecting over port 22, but if your host tells you otherwise, add -p port to the end of the above command. Replace port with the correct port number. Example: 

ssh [email protected] -p 21

You may see a security warning. Just type yes to continue; it should only happen the first time you connect to a new server.

When prompted, type in your SSH password. With that, you should be connected!

connected to server via ssh

Last note: If your host does have an SSH console in their back end, connecting works exactly the same as it does on Mac or Linux.

Connecting with Windows

For Windows users, the process is similar, but takes just a little more work. Recently Windows 10 implemented both an OpenSSH client and a way to run a Linux distribution (Terminal included), so this could be very easy. If you have an older version of Windows, you’ll need to install an SSH client.

The easiest method: Using the OpenSSH client built into Windows 10. You can check if you have it installed by going to Apps & Features > Optional Features. Look for OpenSSH Client. If you don’t see it, click Add a feature and install it from there.

Open up Command Prompt and type in ssh to check if it’s working. If you get an error, try rebooting or relaunching the program.

If it does work, you can now connect with the usual command, mentioned above:

ssh [email protected]

Another option is running a Linux subsystem on your machine. 64-bit versions of Windows come with a Linux bash shell built in. In that case, all you need to do is activate the feature and install a Linux distribution from the Windows store.

Here’s a guide to installing the Windows subsystem for Linux. Ubuntu is a good one to start with as it specifically supports the Terminal. Once you’re set up, just follow the guide above to run the right commands and connect to your server.

Your last option — and the only option if you’re not running Windows 10 — is to install an SSH client like PuTTY.

connect to ssh via putty

Launch the program and input the host name/IP and the port number. Make sure the connection type is SSH, and click Open. Then, put in your username and password, and you’re connected.

Learning the Command Line

The special thing about SSH, compared to something like an FTP client or the WordPress dashboard, is that it uses the command line. Graphical interfaces are generally easier to navigate, but much less efficient. With SSH, you don’t have to navigate menus or click on anything. You just type a command and it executes.

However, the downside is that the command line can be a little difficult to get used to. Here’s a list of essential SSH commands to start you off.

  • ssh [email protected] — Connect to a server. Add -p port to the end to use a different port.
  • cd — Move to a different folder.
  • ls — List the files inside a folder.
  • mkdir — Create a new folder.
  • pwd — Show the path to the folder you’re at now.
  • touch — Create a new file.
  • rm — Remove a file.
  • cat — Show the contents of a file.
  • head — Read the first ten lines of a file.
  • tail — Read the last ten lines of a file.
  • du — Show the size of a file.
  • cp — Copy a file or folder.
  • mv — Move a file or folder.
  • zip — Compress a file or folder.
  • unzip — Extract a compressed file or folder.
  • find — Search for files and folders.
  • grep — Search for a phrase inside files and folders.
  • wget — Download a file from the Internet onto the server.
  • scp — Copy a file to your computer.
  • vim/nano — Edit a file using either the Vim or Nano text editor.
  • clear — Clear the terminal.
  • history — Show the last 50 commands you used.
  • exit — Close the connection.

If you want to learn more, there are many resources that go in-depth into basic SSH commands. Also try this beginner’s guide to the Linux command line.

Using WP-CLI

WordPress users should definitely look into WP-CLI, a command line interface tailored for the CMS. You can get a lot done with the default commands, but there are a lot of WordPress-specific tasks that are impossible to pull off with basic SSH access.

Your host may already come with WP-CLI installed, so all you have to do is connect over SSH and start issuing commands.

Otherwise, if you already have SSH access, you may be able to install it yourself. All you need is PHP 5.4+, WordPress 3.7+, and a Linux or Mac OS. You can find a WP-CLI installation guide in WordPress’ documentation.

Here are a few WP-CLI commands that might be useful to you: 

  • wp cli — Get info on WP-CLI and check if it’s installed properly.
  • wp core — Manage the core WordPress installation, update it, etc.
  • wp plugin — The root of various commands for managing plugins. For example, wp plugin list lists installed plugins, or wp plugin deactivate pluginname deactivates a plugin with that name.
  • wp theme – Activate, delete, and install themes.
  • wp user – Manage, create, and delete users; remove or add permissions.
  • wp comment – Moderate, add, and remove comments.
  • wp post – Manage your posts.
  • wp db – Manage your database.

And there’s so many more advanced things you can do with WP-CLI, from executing PHP code to managing Cron scheduling on your site.

SSH for Beginner’s in a Nutshell

Why waste time working in the slow WordPress back end? Being a developer means finding more efficient ways of accomplishing all those mundane tasks you’re faced with every day. With SSH, you can instantly connect to a website and execute commands from anywhere.

Connecting through SSH isn’t a possibility for everyone, especially those using shared hosting. And if you’ve never worked with the command line before, or are new to web development in general, it can take some getting used to. But once you’ve tried it, you’ll never go back.

Do you prefer working with the command line or in a graphical interface like WordPress’ back end? Does it depend on what you’re doing? Let us know what you think in the comments.

Source link

Continue Reading
Click to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.