Beginner

Securing, Updating and Backing Up a VPS Control Panel

Picture of Richard Sutherland
Richard Sutherland

Introduction

In this final tutorial of the series, we’ll look at the upkeep a control panel needs once your sites have been migrated to it. On a self-managed VPS, securing the control panel, backing up your sites, and installing updates are usually your responsibility, not the hosting provider’s.

Your control panel gives you the tools for most of this work, with security settings for its logins, a backup feature, and a way to update it. Our examples use HestiaCP on an STW VPS, with notes on where the other control panels in this series work a little differently.

Step 1 — Secure the Control Panel

The control panel’s administrator account can manage every hosting account and the services its sites use, which is why all the installation guides in this series set up HTTPS for the control panel and a separate account, without administrator rights, to own your sites. Once the server is running, it’s time to check a few more things.

  • Turn on two-factor authentication (2FA) for the administrator if your control panel supports it. In HestiaCP, you’ll need a code from your authenticator app as well as your password when you sign in.
  • Remove logins nobody uses. In the control panel, delete user accounts you no longer need, such as one you set up for a developer on a finished project. Deleting a hosting account typically also deletes its sites, so check it doesn’t include anything you want to keep.
  • Check that brute-force protection is running, if your control panel offers it. Brute-force protection blocks an IP address for a while after repeated failed logins. HestiaCP and Sentora use Fail2Ban, and on HestiaCP, fail2ban-client status should list jails (the services it watches) for SSH and the control panel.
  • Restrict the admin login to your own IP address if you only access the control panel from one location with a fixed IP address. Our installation guides in this series show you how.
  • Know your way back in. If a firewall change or a failed update cuts off SSH and the control panel, you can open noVNC Console on the VPS’s page in the STW control panel. The console connects directly to the VPS, so you can sign in even with SSH blocked, as long as Ubuntu reaches the login prompt.

Step 2 — Back Up With the Control Panel

HestiaCP backs up each hosting account separately. A hosting account is the user that owns one or more sites in the control panel, and its backup typically holds the sites’ files, their databases, and the account’s settings, such as its domains and scheduled tasks (cron jobs).

If you lose the whole VPS, for example to a hardware failure or a break-in, you can install HestiaCP on a fresh VPS and restore each account from its archive. Changes made outside the control panel, such as firewall rules you added over SSH, aren’t in the account backup, so keep a note of them.

A backup kept only on the VPS is lost along with it, which is why we send copies somewhere else too.

Set up remote backups in HestiaCP

HestiaCP backs up each active account every night and keeps the archives in /backup on the VPS. To make it send copies somewhere else too, sign in as the administrator, click the gear icon (Server settings), choose Configure, and open Backups. Leave Local Backup ticked, tick Remote Backup, and choose a Protocol, which decides how HestiaCP sends the archives and where they can go. There are four options.

  • SFTP sends the archives to another server you can log in to, such as a second VPS or a storage device (NAS) in your office.
  • FTP works the same way but sends your password unencrypted, so it’s best to avoid.
  • Backblaze uploads to Backblaze B2, a pay-as-you-go cloud storage service.
  • Rclone uses rclone to reach many other cloud storage services. You set up the connection over SSH first, as HestiaCP’s backup documentation explains.

We’ll use SFTP in this example. Enter the backup server’s address, port, username, password, and destination folder, then click Save. From the next nightly run, HestiaCP keeps a local copy and sends another to the remote server. Choose a destination only you can access, because an archive can contain database passwords and customer data.

HestiaCP's Configure Server page with the Backups section open, Remote Backup ticked, and SFTP details entered for an example backup server

We recommend raising the number of backups HestiaCP keeps, because the default package keeps just one. Once an account reaches its Backups limit, each new archive replaces the oldest on both the VPS and the SFTP server.

Open USER → Packages, edit the package your accounts use, and set Backups to the number of copies you want to keep. A limit of seven keeps the last seven archives, including any you make by hand between nightly runs. Check you have disk space for them on the VPS.

The day after you set this up, look in the remote folder for an archive named after the account and the date. If it isn’t there, open /var/log/hestia/backup.log on the VPS, for connection or folder errors.

Using another control panel? Some control panels restore a whole account from one archive, as HestiaCP does, while others back up files and databases separately and restore them one at a time. If you’re using WordPress, a backup plugin can add a second, independent copy.

Test a restore once

Try restoring a backup so you know the archive holds everything and you’ve practised the steps before you need them in a hurry. Restore it on a separate VPS, so you can check the recovered site without overwriting the live one. If you run WordPress, our WordPress backup and restore tutorial covers restoring a single site.

Step 3 — Update the Control Panel

Control panel updates fix security holes in the control panel’s code. Some control panels install their own updates, while others wait for you to run them. Here’s a summary:

Control panel Updates itself by default? To update by hand
HestiaCP Yes, daily apt update && apt upgrade
ISPConfig No ispconfig_update.sh
CyberPanel No Run the upgrade command from CyberPanel’s support page
DirectAdmin Yes, except software managed by CustomBuild da update
CloudPanel No clp-update
OpenPanel Yes opencli update --force
Froxlor No apt update && apt upgrade, then sign in to finish
Sentora No Follow the instructions for your release

Before a control panel update, read the release notes first, because a major release can change requirements or restart services your sites use. Pick a quiet time and make sure you have a current off-server backup of every hosting account.

To take a fresh backup of an account in HestiaCP, sign in as the account’s user, open BACKUP, and click Create Backup. HestiaCP queues the job, so reload the list after a minute or two, then hover over the new archive’s row and click the download icon to keep a copy on your computer.

HestiaCP's BACKUP tab listing a completed archive, with the download, restore, and delete icons visible on its row

For a major release, take a snapshot too. A snapshot is a copy of the whole VPS disk at one moment, and rolling back to it returns the server to how it was when the snapshot was taken. Open the VPS in the STW control panel, go to Snapshots, and start the update once the new snapshot shows Active. Our Ubuntu upgrade tutorial walks through taking a snapshot and rolling back.

After a control panel update, sign back in and check that the control panel shows the new version. Next, open your site in a private browser window and sign in to its admin area.

If something fails, read the update’s output and the control panel’s logs (HestiaCP’s are in /var/log/hestia/) before changing anything else. If you can’t connect over SSH, use the noVNC console from Step 1.

Step 4 — Update What the Control Panel Doesn’t

Control panels usually update only themselves. On most servers, Ubuntu itself and the software that runs your sites need an update routine of their own.

Check Ubuntu’s automatic security updates

Ubuntu’s unattended-upgrades service installs security fixes for Ubuntu’s own packages each day. It’s switched on by default. To check the schedule, connect to the VPS over SSH as root and run this command.

cat /etc/apt/apt.conf.d/20auto-upgrades

You should see these two lines.

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

The first tells Ubuntu to refresh its package lists daily, and the second tells it to install the security updates. A "0" in either line means that part is switched off. To see when Ubuntu last ran the job, check the latest entries in /var/log/unattended-upgrades/unattended-upgrades.log.

Update the software that came from other sources

Many control panels install the web server, PHP, and database from those projects’ own package sources. By default, HestiaCP gets nginx, PHP, and MariaDB this way, and Ubuntu’s automatic security updates skip those sources. Check for waiting updates every week or two with these commands:

apt update
apt list --upgradable
apt upgrade

apt update fetches the latest package lists, apt list --upgradable shows what would change, and apt upgrade installs the updates after you confirm.

Kernel updates, including the security fixes Ubuntu installs automatically, only take effect after a restart. When one is waiting, you’ll see System restart required as you sign in over SSH, so run reboot at a quiet time.

DirectAdmin works differently. CustomBuild compiles the web server and PHP from source instead of installing them as packages, so apt doesn’t update them. Instead, check CustomBuild → Updates in DirectAdmin on the same schedule.

Update your sites

Follow your site’s own update procedure too. In WordPress, for example, you can update the core software and plugins from the dashboard. Our guide to updating WordPress safely covers the order and the checks, and our PHP update tutorial explains how to check compatibility before you change PHP versions.

Conclusion

Once it’s set up, most of this maintenance is a simple routine. Every week or two, install waiting package updates and reboot if Ubuntu asks for it. Before a major control panel or Ubuntu upgrade, take a fresh backup and a snapshot.

If you’d like a hand with any of this, contact us to ask what help is available for your VPS.

Next steps:

Success!

If you found this tutorial helpful, please consider giving it a like and sharing it with others in the community.

Scroll to Top

Share

Share this link via

Or copy link

https://stw.no/en/tutorials/control-panels-for-web-hosting-on-vps/how-to-migrate-wordpress-website-2/Copied!

Share Your Feedback