How Vaultpress Saved my Ass and how it Might Save Yours too ( Setting up Guide )

Disclaimer: Vaultpress is included as part of the Jetpack Personal Plan and this post is not meant to endorse or promote the product. It is simply a personal anecdote on how the product personally helped me and a mini-guide to setting it up. No affiliate links will be found in this post.

Pictures will be added when my computer is functioning properly. . . That’s another story for another time.

A bit of background information

Yesterday, due to negligence, my website went down after installing a plugin. It corrupted the database and there seemed to be no way of getting back to how things were… at first.

A day before that I had purchased the personal Jetpack plan that came with Vaultpress. I didn’t have a chance to look into it so it did its thing by default. .. which was of course backing up.

15 days prior to that I had created a snapshot of my Droplet to upgrade to Ubuntu LTS 18.04

Forward back into the future, I had no live backups (my fault, of course) other than the one from 15 days ago.

With much heartache, and manual copying of posts, I proceeded with the Droplet restoration process and assessed the damage. It was a drastic change, much bigger than I anticipated as I had even messed with the site’s theme at the time.

I reconnected to WordPress.com, activated my plan and lo and behold.. Vaultpress. I decided to check out the plugin’s functions, seeing as I had nothing left to lose.

The backups performed were listed and there was one in particular that was from 9 hours ago! That was 2-3 hours before the disaster.

Clicking on restore did nothing for me as it wasn’t set up and this is the middle of my journey and all the tidbits on how to set it up.

First, and foremost, this website is powered by WordPress.org and hosted at DigitalOcean and managed by EasyEngine. What does that mean? This guide is not tailored toward those that are using a shared hosting environment … but some parts might apply!

Note: This is not a server backup but a WordPress one. A complete one with databases, themes, plugins, settings, posts, etc.

Setting up Vaultpress

By default, Vaultpress isn’t set up. It is able to back up plugins, databases, themes, etc. because it is storing this information it in its servers but it has no way of automatically writing into your files should you initiate the restoration process.

We need to set it up. Vaultpress offers several options for restoring your files, database, etc. The most secure option is .ssh access via means of a public key. This does not require a password.

It might be because I’m using EasyEngine but I could not get this to work without inputting a password. Any method of creating a non-root user and adding an .ssh key would involve changing permissions which would mess up once restoration was complete.

Navigate to your Vaultpress Dashboard > Settings >

By providing access to your server, VaultPress runs more efficiently and our Safekeepers are able to help you faster in case of an emergency. You typically receive this information when you set up your site from your host. . .

via ( Vaultpress Settings)

We are going to concentrate on SSH Settings

Method 1: www-data SFTP User (EasyEngine)

This method will work for FileZilla as well. It involves setting up the www-data user which by default is not accessible as a user you can .ssh into. Despite being made for SFTP purposes, this will work just fine for Vaultpress’ .ssh requirements but it involves a password. This, of course, strips away some of that security layer but after messing with it for nearly the entire day, it was the most migraine-free solution I could settle on.

The perks of this solution? It won’t mess with file permissions… meaning after restoring, you won’t receive errors of not being able to update plugins, etc.

You need to .ssh into your root account.

Set up a Password for www-data

Type the following command via terminal:

sudo passwd www-data

You should choose a very strong password and store it somewhere safe.

Set up the Login Shell for www-data

Type this command:

grep www-data /etc/passwd

If you receive information back that has /sbin/nologin appended to the end of the string? We need to make modifications.

Type this other command:

nano /etc/passwd

You need to locate this line:

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

And change it to read:

www-data:x:33:33:www-data:/var/www:/bin/bash

Verify that you can .ssh into www-data as a user with the password you chose.

The login credentials you used would be fed into your Vaultpress .ssh settings to read:

Server: example.com (set by default)

Port: 22 (set by default)

Username: www-data

Password: Password you chose for www-data

If you did this correctly, it will turn green and read SSH access saved & working

Method 2: Root + SSH ( EasyEngine)

This method is a quick and dirty way of getting it done but not at all recommended. It involves adding the secured .ssh key into your root account, inputting the credentials, restoring your backup and fixing permissions.

Let’s get to it.

We will begin by logging into our root account.

Next, we will add the secured key to Authorized Keys. Your VaultPress SSH key can be found when you expand the SSH Settings.

Type this command

nano ~/.ssh/authorized_keys

Go ahead and paste your .ssh key into the editor and CTRL+O to write to the file and CTRL+X to exit out.

Go back to your Vaultpress Dashboard > Settings > SSH

Server: example.com (set by default)

Port: 22 (set by default)

username: root

Password: Leave this blank as we are using our .ssh key and save your credentials.

You should not receive any errors.

Go ahead and restore. Once you are finished and you’ve verified that things are working as they should, it’s time to fix permissions.

If you tried to update plugins, themes or anything right now, you would receive a bunch of errors or WordPress would ask for your SFTP credentials.

Fix EasyEngine Permissions

Replace example.com with the actual name of your server.

Type the following commands. I used my root account you might need to append sudo in front of any of these commands.

chown -R www-data:www-data /var/www/example.com

find /var/www/example.com -type d -exec chmod 755 {} ;

find /var/www/example.com -type f -exec chmod 644 {} ;

Now Vaultpress can still write to your files but after each backup restore, you have to fix permissions. Again, not recommended. I’ve included it for the sake of completion or it might save you in a pinch.

The setting up process was the most painful one.

Other methods involve setting up your sudo user and adding the login credentials but I couldn’t get this to work without messing with permissions.

After setting up, the restoring process was pretty straight forward. It was a one click process after choosing the selected backup but I’ll walk you through it anyhow.

Restore your Backup Using VaultPress

Navigate back to the dashboard > Backups

Select your desired backup and you’ll be able to see the Backup contents > Download or Restore

Here, you are given the option to download all the contents to your computer or restore.

Select Restore > Prepare Backup (Don’t uncheck things unless you know what you are doing.)

You should see both options (site address and valid FTP/SFTP) marked green. Select Restore Now

Your backup will fail if it takes less than a second even if marked complete. Look out for an email containing your results.

A progress bar will begin to run until it reaches 100%. You’ll be able to see in detail the files being downloaded and the process running.

Once it is complete, look out for an email. This should serve as additional verification that the restoration was successful.

Verify that everything is working as it should.

Wrapping up

My Vaultpress Settings are marked to backup daily but I might change that depending on how much I write. A new Droplet image was created just in case. I wish I could say lesson learned but this simply isn’t true.

Take care to create backups when necessary and I hope this mini guide is useful to someone else.