What is SSH?

Secure Shell (SSH), sometimes called Secure Socket Shell, is a network communication protocol that uses the client-server model to let two computers communicate via a secure remote connection. Using SSH, the client and server communicate through an encrypted connection, eliminating the risk of man-in-the-middle attacks, and keeping data transmissions private. 

SSH also refers to the utilities that implement SSH protocol. Users can use this command line interface (CLI) to execute shell commands and perform various file operations on a variety of devices like remote computers, web servers, and routers, among others.

 

Web hosts and SSH access

SSH is an indispensable tool in web hosting, although you may need some technical knowledge to take advantage of all the command line interface’s capabilities. You can use it to securely create backups, transfer files, and perform file operations like copying, pasting, or moving files on the server. With the proper permissions, users can execute different commands on a remote host, including shell and bash scripts. SSH gives users the tools to manage servers effectively through a secure, remote connection.

Secure File Transfer Protocol (SFTP) uses an SSH connection in combination with FTP to securely transfer files. This extra layer of security keeps all data transfers private and encrypted.

How to use SSH?

Using SSH starts with an SSH client like PuTTY (Windows) or OpenSSH (Linux systems) that communicates with the server. Next, users enter the remote machine’s IP address or hostname and port number along with user credentials such as username and password or public key. The remote server runs a daemon that monitors a specific port for incoming client connection requests. Finally, a new SSH session is established if the user’s credentials are correct.

Using a command line based client like OpenSSH, users run SSH and request the connection using their username and the remote computer’s IP address and port:

ssh username@ip_address -p 22

The client and server exchange identifying information, and prompt for the password or public key. After entering the password, if the user’s credentials are correct, the SSH session starts.

how ssh works

When to use SSH?

SSH is a valuable tool for managing files and servers remotely, but its usefulness doesn’t stop there. With SSH access and the correct permissions, you can completely control the remote host’s Operating System (OS) with commands and scripts run through the remote shell. For example, you can view and monitor server and application load, use it to make bulk changes to files, or use any other shell command the same way you would on a local machine.

SSH access also presents the perfect opportunity to install the WordPress Command Line Interface (WP CLI). This tool allows you to work with WordPress without a web browser or the familiar WordPress dashboard. Using SSH, you can pass user credentials along with any WP CLI command on a remote server.

Getting started with WP CLI is simple, with just a few lines in the terminal to install it. Once connected through SSH to the WP CLI, you have fast, secure access to all files and directories in a WordPress installation. It provides an efficient way to perform, or even automate certain tasks such as:

  • Core updates
  • Managing plugins and themes
  • Create XML and database backups
  • Find and replace across multiple files or databases
  • Change permissions for users, files, directories, etc.
  • Moderate comments
  • WP Cron jobs

WP CLI is also a powerful tool for working with WooCommerce. You can create bulk products or lists of orders and customers, manage WooCommerce memberships, and much more. Use it to complete any task you would normally use the WordPress dashboard for, and take advantage of this utilitarian tool’s time-saving, simplified interface.