SSH Gateway FAQ
In this article we give answers to common questions and misconceptions about SSH Gateway on WP Engine. If you have questions about how to get started using SSH Gateway access, please see our Getting Started guide.
Please note: SSH Gateway available for customers on dedicated servers. Please contact your Account Manager to check if your account qualifies for access.
What is SSH access?
SSH stands for “Secure Shell” and is the authentication method two devices (computers, servers, or other internet devices) use to communicate with each other. On the WP Engine platform, SSH Gateway access means the ability for you to connect remotely from your local machine to a container where your site’s content is hosted.
Who can use SSH Gateway?
Developers who are testing, building, or managing multiple websites can and should use SSH Gateway. It should be used by people who are familiar with the use of command line, bash, and WP CLI. SSH access is only available on Premium and Enterprise plans currently. Learn how to enable SSH Gateway in our guide.
Why should I use SSH Gateway?
SSH Gateway is ideal because it allows users an easy, secure interface to interact with their site’s files and content. With SSH access users can manage their site with WP CLI commands. WP CLI allows developers and site administrators to manage their site outside of the confines of the WordPress back-end, which allows for faster work and chained commands to automate site workflows.
What can I do with SSH Gateway?
SSH Gateway allows users to manage WordPress sites via a command line interface so you can save time and automate various tasks. This includes using WP-CLI to manage WordPress settings and administration, navigating files and directories, using rsync and SCP to move and transfer files, and using MySQL command line to manage databases. Users can even create scripts and bash loops to automate tasks that previously would take a lot of manual work.
Can you give me some examples?
Sure!
#install the Yoast (wordpress-seo) plugin and activate it
wp plugin install wordpress-seo --activate
#sync all the files in the “myplugin” folder over to wp-content/plugins/mynewplugin/
rsync -rvP myplugin/ ../wp-content/plugins/mynewplugin/
#import the mydbfile.sql file to your WordPress database
wp db import mydbfile.sql
#search and replace your old domain with your new domain with precise (SQL-based)
wp search-replace “myolddomain.com” “mynewdomain.com” --precise
#use the vi editor to view or edit the mysqlfile.sql file
vi mysqlfile.sql
#remove the “oldfolder” folder and all its contents
rm -rfv oldfolder/
How is SSH Gateway different than Git?
Git is a version control system used to deploy file changes from your local machine to your website. SSH is the method of connecting directly from your local machine to your sandboxed environment for your website’s server. SSH Gateway is not meant to be a means of deploying local file changes like Git. Furthermore, build tools like Grunt, Composer, and Gulp are not able to be used with SSH Gateway.
What can I NOT do with SSH Gateway?
In general, you cannot use SSH to manage the aspects of your site that are in the User Portal (purge cache, create users, add a new install). You cannot use SSH Gateway access to perform any actions that require root or sudo access, and cannot use it to access server logs.
You can only create new, permanent files or directories in the /sites/[install]/ directory. Newly created files outside of this path will disappear when your SSH session ends. Because of this, any scripts you create should be stored in your site’s _wpeprivate folder.
Can I use the same SSH key as I do with Git?
Yes, you can use the same key. However, best practice would be to use two separate keys as the services are currently separate. In the future, if the two services end up merging it will be an easier transition if you start with two separate keys. In addition, if you use multiple SSH keys (one for Git, one for SSH Gateway) it is best to use a config file. Because a config file will tell your computer which key to use when, this simplifies the connection process. Please review our SSH Key Management article for more help setting up this file.
How is SSH Gateway different than the Advanced tab in my User Portal?
If you have access to the Advanced section in User Portal, you have the ability to run WP-CLI commands there. The tool in the Advanced section has some limitations in the way it runs, such as timeouts, and some limitations on WP-CLI commands. Furthermore, SSH Gateway offers full access to command line tools beyond WP-CLI, so you have a wide variety of powerful bash commands at your fingertips to manage your website, content, and database.
When is SSH Gateway available?
SSH access is in limited availability currently. It will be available to more plan types in a gradual roll-out over several months.
Is SSH access on WP Engine different than with other providers?
Yes. WP Engine uses a sandboxed SSH environment to ensure the highest security level while allowing access. Each site will have its own unique connection details and a separate sandbox to ensure there is no cross-contamination of sites or resources.
When connected through SSH, you will be able to access the WordPress files and database as though you were connected directly to the server, but you won’t see all of the standard processes that are running on a server, such as Apache or MySQL.
While you have the ability to create new files, only files which are created within the /sites/[install]/ directory and below will remain after your SSH session ends. With that in mind, if you wish to store bash scripts for site, these should be placed within the _wpeprivate folder.