SSH is one of the best tools in a developers tool-belt. It can be used to set up advanced environments, manipulate sites, use great tools like WP-CLI for automating common WordPress tasks or to access a site when all else fails. In this article I’ll look at what SSH is and how you can connect via SSH to your server.
Getting Started With SSH
According to the specs, SSH is “a protocol for secure remote login and other secure network services over an insecure network”. In other words: it’s nothing more than a way to log in to a computer and access the services it offers.
To log into your site’s container you’ll need two things: An SSH client and login details.
Still looking for that perfect WordPress host?
- Fully managed
- Secure like Fort Knox
- Free migrations
- Ultimate speed
- Daily backups
- Google Cloud Platform
On OSX and Linux you have everything you need to get started, you can use SSH from the terminal without any special software. On Windows you’ll need and SSH client, the most popular one is Putty. I’ll give Windows users a quick Putty tutorial further down.
To log in via SSH you’ll need at least four pieces of information:
- Server address
The server address is usually your domain name or and IP. At Kinsta we use your
site’s IP address.
In some cases, if the default port is required, you might not need to specify it. At Kinsta we take security seriously so we use different ports for different sites.
If you are a Kinsta customer you can find your server’s details on your MyKinsta admin. All of our plans include SSH access. Select the site you’d like to connect, you’ll find all the details you need.
In fact, if you’re using the terminal you can simply copy-paste the command generated for you in the SSH section to connect instantly (you’ll still need to enter your password of course).
This section is for Windows users, if you’re on Mac or Linux, skip to the next section. Once you’ve downloaded Putty you can run it by double clicking the icon. You’ll see a screen that looks something like this:
You can get started right away by pasting your server address in the host name input field. Enter the port number next to it in the port field, make sure protocol is set to SSH and click open at the bottom.
You should see a Window which looks similar to a Linux terminal. It will ask for your username which you should enter and press enter. Do the same with your password, press enter and after a few moments you should be logged in.
Along the way you may get a notification about RSA fingerprints or other matters. Feel free to press OK to move on.
Connect via SSH in the Terminal
This section is for Mac and Linux users only, if you’re a Windows user and you’ve already set up Putty, skip below.
On Mac or Linux all you need to do is open the terminal and issue a command. The command takes the following form:
ssh username@hostname -p portnumber
Substitute the information with your actual username, host name and port number and press enter. You’ll be asked for your password which you should type in and press enter. If you receive any notifications about RSA fingerprints or other matters feel free to press enter or “y” to move on.
Issuing SSH Commands
From this point on the experience will be the same whether you’re on Windows or Mac. You now have the option to issue commands, just as you would in the terminal on your own computer. There are many neat things you can do, especially if you’re on a Kinsta server!
A word of warning. SSH access usually gives you a lot more freedom than you would normally have. This includes the ability to royally mess things up. You could delete your whole WordPress directory, all your images, stop essential services on your server. always use caution when using SSH you can do a lot of damage accidentally.
WP-CLI is a command line interface for WordPress and gives you all sorts of neat tools. Kinsta servers have WP-CLI available out of the box so you can start using it as soon as you log in. For other servers, you may need to install it yourself, take a look at the website for more information.
Once you’re up and running with WP-CLI you can issue some commands! To do that you’ll need to move to a directory with WordPress installed. If you’re not sure where you are at the moment, use the
ls command to show you the contents of the current directory.
At Kinsta you’ll arrive in your site’s home directory. You’ll need to navigate to the public directory using
cd public to get into the WordPress root directory.
wp plugin list to get a list of all plugins available to the site.
To do something more helpful you could run
wp plugin update --all which would update all your plugins at once, or
wp plugin update --all --dry-run which will give you a list of plugins that would be updated if you’d run the first command.
There are many useful commands WP-CLI commands, take a look at the Documentation for more info.
What Else Can I Do?
The short answer is: almost anything. You can now start using tools like git, npm, WP-CLI and others to give you more control over your website and your deployment environment. SSH is a great tool for interacting with your server and is pretty easy to get started with. Happy SSH-ing!