Knowledge Base

Using SSH for Individual Sites

Category: Tutorials | Last modified: January 31, 2023

Please note: SSH & WP CLI access is currently in closed, early beta testing and is not yet available to all Pressable users. Due to the complex nature of SSH and WP-CLI, we are not able to provide extensive support for using these tools. Pressable support is available to help with issues connecting via SSH but cannot guide you through using commands.

SSH, or Secure Shell, is a protocol that allows you to connect to services such as web servers. This allows you to connect to our servers and manage your WordPress website via command-line tools such as WP-CLI.

SSH access is currently activated at the account level and so is available for all sites on your account and all collaborators with SFTP access on those sites.

How to connect via SSH:

Step 1: 

Get your SFTP credentials from the Users tab for the site to which you want to connect. 

Note: You must click the password regenerate icon to set an initial SFTP password or you will get a connection error.

Screenshot showing how to obtain SFTP credentials in the Pressable dashboard

Step 2: 

From your terminal client use the following syntax to connect. Please be sure to replace [username] with your own SFTP username from the Users tab.

ssh [username]

When prompted enter your SFTP password

Screenshot showing the initial SSH connection prompt in a terminal client

Step 3:

Once you are connected you can use SSH and WP CLI commands. 

How to take backups before making changes via SSH:

It is possible to quickly and permanently alter or delete data via SSH. While you can restore using our automated backup and restore tool it’s possible that you may lose data or changes made since the last backup was taken. 

For this reason, we strongly recommend taking a manual backup before making changes via SSH. Placing these files in your /tmp directory will prevent them from being accessible from the web.

To take a database backup:

cd /tmp
wp db export

To take a site files backup (replace [additional info] with the date or another useful identifier):

cd /tmp
tar -czvf sitefiles[additional info].tar.gz /htdocs/wp-content

To remove a backup file once you no longer need it:

cd /tmp
rm [name of file]

Common questions:

What if I need to SSH into multiple sites?

Because ssh users exist on a per-site, not a per-account basis, you will need different credentials for each site. You can automate getting SFTP user credentials with the Pressable API.