Automatically backup all cPanel/WHM Accounts to remote SFTP server!

For all the system administrators out there, backing up data is really important job. Because we all know what happens when server crash happen, or a hard disk drive fails. cPanel/WHM is one of the most comercially used software by web hosting companies and individuals. They have a really nice built in system for backing up accounts to following remote locations:

  • Amazon S3
  • FTP
  • SFTP
  • WebDav

Well that is more than enough right ? As you can see you already have the option of FTP and SFTP, what else you may need? But before you continue you need a storage server that can host your backups. You can buy a very cheap storage server from here. ($3.99 euro for 1TB of backup space). Incase you already have storage space you don’t need to buy a seprate storage server.

Well, let see that how we can use WHM to backup all or selected accounts to any of these destinations mentioned above.

Step 1: Select the Accounts to Backup!

WHM let you select which accounts you need to include in the automatic backup process, please see in the image below that how we can do this:

  1. Search for “backup” in the search box.
  2. Than select “Backup User Selection” from the list.
  3. Now on the third arrow, if you want to enable backups for all cPanel accounts you can click “Enable All Backups”.

However if you are not interested to enable backup for all accounts, you can turn them “on” or “off” for each account. Once you are done with user selection, we can configure the backup settings for automatic backups to a remote server.

Step 2: Enable Backups!

Next step is to enable your backups settings, so that backups can be created on daily, weekly or monthly bases.


  • Search for “backup” in the search box.
  • Than select “Backup Configuration” from the list.
  • Now enable the backups as they are enabled in the image above. By default they are disabled so you must enable for backup function to work.

Step 3: Select Backup Type!

  • As you can see you have 3 options available, and I’ve selected the first option which is “Compressed”. Now it depends on your setup, if you have less storage space for backups you need to select compressed backup type, however it will put some load on your server for compression to take place.
  • If you select uncompressed, it will save all files to the remote server uncompressed, so there is no cpu overheads on the server but than you require more space on the storage server.
  • The third option is very new in WHM and which is incremental, you should not select it because with this option you can not store backups to remote locations. This option only works for backups in local directory.

Now it depends on your usecase that which option works best for you.

Step 4: Schedule Backup!

Now we need to select that how often you need to backup your accounts, there are three possible options.

  • Monthly.
  • Weekly.
  • Daily.

My current settings looks like:

Now it is totally upto your requirments that how often you are interested to backup your accounts.

Step 5: WHM Backup File Related Settings!

These are some miscilinious settings weather you are interested in enabling backups for suspended accounts or you need to store backups for access logs or not, you can leave these settings as they are, my settings looks like:

Step 6: Database backup!

Well this option is an important one, database backups are important to restore the WHM account restore feature.

You must atleast select “Per Account Only” option , this way you can use the backup file directly to restore account from WHM. All you will need to do is upload the backup file in “/home” directory of your cPanel/WHM server and than restore the account from WHM, we will discuss on how to do that in another article.

Step 7: Configure Local Backup Directory!

Before backups are sent to a remote location, they need to be stored at local directory first. You need to specify where WHM should store backups locally, you need to be carefull that this directory should have enough space to accomodate backups.

As you can see that I’ve unchecked the “Retain backups in the default backup directory“, because this will save space on your WHM server, it means once the backups are transferred to a remote location, they will be deleted from your WHM server. But you can always turn it on if you need. 🙂

Step 8: Create Backup Destination

Now this is the step where we need to define a remote server which will house our backups. For that you are going to need a server, with SSH or FTP access. I am going to demonstrate that how you can do this with ssh access, same will apply to ftp server as well.

  1. From drop down select “SFTP”.
  2. Than click “Create new destination”.

Following will than appean:

Destination Name: Give any friendly name to your destination.

Backup Directory: Remote backup directory where WHM will send the backups, i.e. /root/backups.

Remote Host: IP Address of the server.

Port: 22

Authentication Type: Password Authentication.

Remote Password: SSH Password of your server.

After filling all these details click “Save and Validate Destination”. It will save the details as well verify the details that you have provided.

Step 9: Finalize the Backup Configuration

Once all the above mentioned steps are completed you can click “Save Configurations” at the end of the main backup configuration window. And we are done, your backups will now be sent to the remote server automatically depending on what scheduled you have choose.

If you have any questions feel free to put them in a question box below.


2 thoughts on “Automatically backup all cPanel/WHM Accounts to remote SFTP server!

    • Author gravatar

      It’s a pity you don’t have a donate button! I’d most
      certainly donate to this excellent blog! I guess for now i’ll settle for book-marking and adding your RSS feed to
      my Google account. I look forward to fresh updates and will
      share this site with my Facebook group. Talk soon!

    • Author gravatar

      The biggest problem with cpanel compressed backups to remote server is that it needs to create the compressed file on the local server first.

      It copies the whole account then compresses it and while the file is transferring, it does this with other accounts.
      1 – It does this every night and thrashes the drives (esp if they are SSD)
      2 – If your server is fast but your transfers are 100mbit it fills up disk space so you have to ensure you have much more space on each vps,/server just sitting there and always be aware of backup sizes.

Leave a Reply

Your email address will not be published. Required fields are marked *