WordPress backup using software like Luis Cobian's open source Cobian Backup is perfect for Windows users, whatever your hosting plan.
That is to say, Cobian Backup's superb if you're cheap like me and don't want to shell out for something like SyncBackPro, arguably the best of the commercial equivalents:
Installed locally, Cobian schedules backups whether remote-to-local (from the server to your PC) or remote-to-remote (to a cloud or another web server, for instance). It has full, differential and incremental backup options as well as a manual override. You can use Transport Layer Security (TLS) or Secure Sockets Layer (SSL) – the secure web protocols covered in wpCop's Web Protocols 101 – for safe dataflow, encryption on-the-fly and a whole lot more besides:
The downside to Cobian is that, for most of us, it's far from straightforward to configure its otherwise tantalizing array of SSL settings, so we won't bother here. Instead, we'll use Tunnelier's super-useful FTP-to-SFTP bridge to secure Cobian's backup facilities online, using SSL in any case.
Let's spell it out …
We want to pull fully automated remote backup through an SSH tunnel. That's set-it-forget-it and solid as a rock. The easiest way to do this, at least on the cheap, is a bit pernickety but it alone will pay for your wpCop subscription, so no complaining. Here are the prerequisites:
- SSH access so we can tunnel mashed up web files from the server and that's possible with any half-decent host as explained in WordPress Administration Using SSL
- Server hostname or IP address which cPanel or your host will provide
- SSH port number designated by your host, 22 by default but often changed
- A username and password, generally those used to access a control panel
- Cobian installed for backup, bridging its FTP function to Tunnelier's SFTP
- Tunnelier installed, again as the ‘Cop set up in that cornerstone WordPress SSL admin tutorial, to give a no hassle secure connection
- Two batch files to let Cobian control Tunnelier
OK, here we go, step by step …
- Install Cobian as a service
The installation wizard offers various options. You should:
- Install Cobian as a service. This is important
- Use the local System account. If you plan to backup local network machines, then choose a user account instead
Otherwise, leaving the defaults is generally best.
- Setting up Tunnelier's FTP-to-SFTP bridge
If you didn't do so yet, set up your SSH access with Tunnelier as outlined in wpCop's Setup SSH for Secure Server Login. Query your web host, else the control panel, for some of the aforementioned prerequisite parameters such as the port number.
There are two more Tunnelier tasks:
Setting up the bridge
Head into the Services tab and simply check-mark Enabled in the FTP-to-SFTP Bridge section, ensuring that the Listen Interface is set to 127.0.0.1 and the Listen Port to 21.
Saving your profile
When you Save Profile As, Tunnelier creates a file which we shall be wanting very shortly, so remember your profile_name.tlp and its location.
Now Login. Upon your first successful connection, a pop up will ask you to Accept and Save an authorization key, so there's a plan.
And now, Logout.
- Creating the batch files
Using something like Notepad, create a file and paste the following, editing the paths to Tunnelier's executable (somewhere in C:\Program Files\...) and to the profile you saved above:
Those parameters start Tunnelier and direct the SSH connection. For more options, open the command prompt with CTRL + R and type:
Save the file, as TunStart.bat, somewhere safe. Open the second new file and paste this:
So that's presumably a kill command, ending the process. Dead on. Save that file, unedited as TunStop.bat, again to somewhere suitably safe and sound.
- Testing your batch files
Shut down Tunnelier entirely by right-clicking its system tray icon (hint: it's white when you're connected, else grey) and choosing Exit, then execute the TunStart.bat file.
Tunnelier should now open a remote SFTP client and an SSH-protected terminal. If not, check the command's file paths both to the executable and to your profile_name.tlp.
Repeat the procedure for TunStop.bat, again informing your antivirus that this is a friend and not a foe. Tunnelier will close entirely.
- Setting up your first Cobian Backup task
You've done the tough stuff. It's all downhill from here you'll be thrilled to hear.
Open the application and set up a task by navigating the Task menu to New Task.
Hooking Tunnelier into Cobian
Let's hook up the batch files first. Open the Events tab and, under Pre-backup events click on the Add drop-down's Execute option, browsing for the TunStart.bat file and ignoring the parameters prompt by clicking on OK. We'll play safe and add a little pause to ensure the task has time to complete so, from the same Add drop-down, choose Pause and give a variable of 15 seconds.
Next, under the Post-backup events choose the Add drop-down's Execute option, connecting the TunStop.bat file and again shunning the parameters box.
Opening the bridge
Choose the Files tab to add your remote Source file location which, remember, this time is actually local because Tunnelier is the go-between. You could elect to Add from Files, Directory or FTP, else by adding an address Manually. Choose the FTP option.
Because we need merely to connect locally to Tunnelier – which in turn looks after our authentication – use the same criteria as for Tunnelier's FTP-to-SFTP Bridge options, adding 127.0.0.1 for the Host and clarifying the Port at 21. The only teeny tease is if we want to specify a Working directory, which we do. Later you should choose – for at least an incremental backup New Task (or a new cloned task) – the WordPress root folder. For now though, purely to prove our configuration, target a small directory containing few files.
Don't bother with the Test button. It won't work in this instance because this FTP screen can't account for our batch files. Instead, OK out of the FTP panel and, back at the Files screen, choose a backup Directory from the Add drop-down in your Destination section.
Now click on OK to leave the New Task dialogue entirely (for now).
Testing the damn thing
This had better work, huh? 😀
To test your settings right-click on the newly created icon labelled New Task or whatever you called it, choosing Run All Tasks NOW!! and confirming the choice.
As well as the Windows terminal popping up, Tunnelier's secure shell and the SFTP client will open. Once your test backup is transferred, everything reverts to closed. Super.
Having confirmed your test backup receipt, right-click on your original New Task icon and Edit task… where there are plenty more options to play with: schedule, compress, encrypt, include or exclude files and more besides. Setting up this stuff is now as easy as pie but, if you get stuck, Cobian comes with bumper help files and an exciting slideshow.
Otherwise, add more new tasks the lazy way by cloning and adjusting your original task with, say, a full weekly backup alongside incremental or differential backups.
And backing up the db?
The database? Oh yes, good point. Seeing as that involves MySQL, as opposed to backing up regular files, our data requires another procedure. Sorry! Check out our WordPress backup tutorials and choose the guide that works with your remote-to-local environment.