Using CodeGuard SFTP/SSH Backups on GridPane

Content Error or Suggest an Edit

Notice a grammatical error or technical inaccuracy? Let us know; we will give you credit!


The following commands change how your GridPane server functions. This may void any support provide by GridPane, use at your own discretion. If you contact GridPane support, inform them that you made these changes.

I’ve been trialing CodeGuard for some of my clients who are mostly on their own custom stack. However, there are a couple that required an offsite solution until GridPane’s remote backups are release as stable and in production.

Enter CodeGuard, of which you can set up as a WordPress plugin or with SFTP for file backups and SSH for MySQL Database backups. I use the latter due to the fact that any PHP software is going to use more resources overall than direct SFTP/SSH/Rsync.


You will need to make sure the following is true if you want to proceed.

  1. Your site has a dedicated system user.
  2. You’re willing to modify your system out of spec of GridPane’s default.

Step 1 – Setting up SSH access for system users

If you’ve read my article Enabling SSH and su from root to user for GridPane System Users then this step will be rather straight forward.

You need to login to your server using SSH as root. Then you need to edit your /etc/ssh/sshd_config and comment out the lines below 3,7

#CONFIG FOR USER=system_user
		Match User system_user
#        ForceCommand internal-sftp
        ChrootDirectory /home/store_vitalbody
        PasswordAuthentication yes
        X11Forwarding no
#        AllowTcpForwarding no

The ForceCommand restricts the system user to only be able to use SFTP commands which is fine when backup up files as CodeGurad uses SFTP. However, for the database backup portion, we’ll need to be able to use MySQL.

The AllowTcpForwarding restricts the use of forwarding SSH tunnels. CodeGuard will use SSH forwarding to connect to MySQL and dump your WordPress Database.

Step 2 – Providing Login Credentials.

I felt like this step was pretty obvious, but I just wanted to make sure that those who don’t have a Linux or Systems Administration background understand what credentials are required.

You’ll need the site’s system user, username and password this is required for the SFTP and SSH/MySQL connection. In addition, you’ll need your WordPress database credentials located in the site’s root folder (not public root “htdocs”). This is required for the database backup.

Good Luck

Edits by Purushottam Kiri


You May Also Like