SSH, also known as Secure Shell, is the method of connecting from your local machine to the web server where your site’s content is hosted. With SSH Gateway access you can use a variety of command-line tools like: WP CLI, MySQL command line, and bash to manage your website.
SSH Gateway uses key-based authentication for even greater security than a simple username and password combination. In this article we’ll cover the steps and all you need to know to get started with SSH access on your website.
Please note: SSH Gateway is currently in Limited Availability and is only an option for specific plan types. Please contact your Account Manager to check if your account qualifies for access.
Step One: Access Your User Portal
The first step to get started with SSH Gateway is to log into your WP Engine User Portal. Just enter your email address and password to log in.
Next, click the dropdown menu next to your name:
On the left side, click “SSH Keys”:
Step Two: Create and/or Add SSH Keys
Next you will need to add your SSH key. If you already have a key labeled “wpengine_rsa” on your local machine, you can simply add the public key here. If not, please follow SSH Key Management first.
Your computer’s key can be used for all installs your WP Engine User in User Portal has access to. If you have multiple computers (e.g. one at home, one at work) which you will use to connect over SSH, it is best practice to use a separate key for each. You can add multiple SSH keys as needed on this page.
Step Three: Connect to SSH Gateway
When connecting to SSH Gateway, you can use the following syntax:
If you do not use an SSH config file to manage multiple keys, you will need to specify which key your machine should use to authenticate the connection like so:
If you encounter any errors in connecting, please reference our Troubleshooting SSH Connection Issues guide.
Step Four: Interact with Your Files and Database
Now that you have successfully set up your keys and connected, it’s time to get started using SSH Gateway to simplify your life! You can use WP-CLI, bash loops, edit files using your favorite editor, and many other CLI tools. Be sure take a backup prior to making any changes, and to reference our FAQ for answers to common questions about SSH Gateway.
Below are some examples of commands you can use:
Import a SQL file to your WordPress site’s database with WP-CLI:
wp db import mynewsqlfile.sql
Install and activate the WooCommerce plugin with WP-CLI:
wp plugin install woocommerce --activate
Run database queries with WP-CLI:
wp db query "SELECT * FROM wp_users WHERE user_email='[email protected]';"
See if WordPress core files have been modified:
wp core verify-checksums
Add “administrator” capabilities to a user named “wpengine” with WP-CLI:
wp user add-cap wpengine administrator
Search-replace for olddomain.com to newdomain.com using precise (PHP-based search) on all tables with WP-CLI:
wp search-replace “olddomain.com” “newdomain.com” --all-tables --precise
Sync all the files from folder1 to folder2 using rsync (non-destructive):
rsync -rvP folder1/ folder2/
Edit a file named myfile.txt using vim:
Enter MySQL command line and query your table storage engine for all tables:
mysql --user=myinstall --password wp_myinstall
SELECT table_name, Engine FROM information_schema.tables WHERE table_schema='wp_myinstall';
| table_name | Engine |
| wp_commentmeta | InnoDB |
| wp_comments | InnoDB |
| wp_ewwwio_images | InnoDB |
| wp_gdbc_attempts | InnoDB |
| wp_links | InnoDB |
| wp_nxs_log | InnoDB |
| wp_options | InnoDB |
| wp_postmeta | InnoDB |
| wp_posts | InnoDB |
| wp_smush_dir_images | InnoDB |
| wp_term_relationships | InnoDB |
| wp_term_taxonomy | InnoDB |
| wp_termmeta | InnoDB |
| wp_terms | InnoDB |
| wp_usermeta | InnoDB |
| wp_users | InnoDB |
| wp_yoast_seo_links | InnoDB |
| wp_yoast_seo_meta | InnoDB |
18 rows in set (0.00 sec)
Update WordPress to version 4.9.1 for multiple sites using a bash loop*:
*You should run loops which iterate through multiple installations from your local machine