# cPanel servers

> Back up cPanel accounts one by one, restore them, and give your customers a Backups page in cPanel.

On a cPanel server, Clokeep backs up each hosting account the way cPanel knows it: as an account.

## Prerequisites

- The agent installed on the cPanel server. The [install command](/docs/servers/install-agent) runs it as root.
- cPanel support, which Clokeep switches on for your [client](/docs/access/users-roles). Without it, the tab, the sync action and the plan type below do not appear.

## What Clokeep detects

A server whose **Control panel** is **None** switches to **cPanel** when its agent checks in. A server set to another panel keeps its setting and shows **Control panel mismatch**, with a **Set to cPanel** button for an Admin or Operator.

## The accounts list

Open the server's page and choose the **cPanel Accounts** tab. Each row shows an account, its **Type** (**Account** or **Reseller**), its **Status** and the plans that cover it.

The agent reads the accounts from cPanel when it starts, then every hour. As an Admin or Operator, to read them now, click **More actions** > **Sync accounts** on the server's page. The server must be **Online**.

Rows that a sync reported are read-only, because the next sync would overwrite an edit and bring back a deleted row. Only a row added by hand can be edited or deleted, by an Admin or Operator.

When an account is removed from cPanel, its row stays. **In cPanel** shows a cross, and plans stop backing it up. A sync never deletes backups.

### Removed accounts

The last backup of a removed account is kept for 90 days, then the plan's retention applies to it. See [Removed hosting accounts](/docs/backups/schedules-retention#removed-hosting-accounts).

The **Last backup** column says where each removed account stands:

- "Removed from the server on" a date, then "Last backup kept until" a date.
- "Last backup kept forever."
- "The plan keeps all backups." when no plan holding its backups has **Keep backups for** or **Keep at most** set. No alert is sent for it.
- "Its backups now follow the plan's retention." once the time has run out.

To keep the last backup for good, click **Keep forever** on the account's row, as an Admin or Operator. The dialog reads "The last backup of this removed account is never released to the plan's retention. You can change this later." Click **Keep forever**.

To undo it, click **Stop keeping forever**. The dialog reads "The last backup is kept until the end of the grace period, and at least a week after a new notice. Then the plan's retention applies to it." Both changes are recorded in the **Audit Log**.

## Back up accounts

<Steps>
<Step title="Create a cPanel server plan">
Open **Plans** and click **New plan**. Choose the cPanel server, then set **Type** to **cPanel server**.
</Step>
<Step title="Choose the accounts">
Under **Back up**, pick **All accounts**, which includes accounts added later with all four components. Or pick **Selected accounts**, click **Add account** for each one and tick its components.
</Step>
<Step title="Choose how it is stored">
**Separate archive per component** stores one archive per component. With **Incremental** on, files and mail are incremental, and databases and settings are included in full every run.
</Step>
</Steps>

The four components:

- **Files**: the account's home folder. Mail, `tmp`, logs, `.trash` and cPanel's caches are left out, and so are `etc`, `ssl` and `.my.cnf`, which **Settings** carries.
- **Databases**: a dump of each database on the server's own MySQL or MariaDB. Others are skipped with a warning in the run log.
- **Mail**: each mailbox of the account, also one created since the last sync, and its default mailbox. Mail stored as mdbox is skipped, and the rest of the account is still backed up. The run ends **Partially completed** and names the account. The run log gives the reason: `mail skipped: mail is stored as mdbox, which is not supported yet`.
- **Settings**: cPanel's own package of the account without its home folder, plus the home's `etc` (mailboxes and their passwords), `ssl` and `.my.cnf`. The archive is encrypted with a backup password that Clokeep keeps for the server.

## Restore an account

As an Admin or Operator, in **Browse Backups**, pick a backup and click **Restore selected backup**, then tick the components to restore. What each component overwrites, and how to restore one mailbox, are on [Restore a Plesk or cPanel account](/docs/restores/hosting-account). Files go back into the account's home folder or a folder inside it. Without **Apply the settings to the server**, the settings are only unpacked on the server for you to apply.

In **Browse Backups**, **Apply the settings to the server** sets **Restore databases** to restore over the original databases only when the account was missing from cPanel at the last sync. An account that was still there keeps the choice you made, and a line under **Restore databases** says which case applies. See [Restore a Plesk or cPanel account](/docs/restores/hosting-account).

<Warning>
Restoring over the original databases empties each one first, also for an account that still exists. In [**Restore accounts**](/docs/restores/bulk-restore), which restores many at once, the switch selects **Decide for each account**: over the originals only for a account that was missing at the last sync, into new databases for the others.
</Warning>

### Bring back a removed account

Tick **Settings** and switch on **Apply the settings to the server**. If cPanel no longer has the account, the agent creates it again from the backup, then restores the components you ticked into it. If cPanel still has the account, the same switch rolls it back instead.

If cPanel is still removing the account, the agent waits up to a minute, then fails with a message that starts "cPanel is still removing the previous account". Run the restore again after that.

Without that switch, files, mail and mailboxes cannot be restored while the account is missing.

### Roll back an account that still exists

<Warning>
A rollback puts the account's configuration, mailboxes and passwords back to the backup. Anything changed since then is lost. Mailboxes created after the backup are removed. Their mail folders stay on the server, and the run log names them.
</Warning>

The rollback itself leaves files and databases alone. They are restored only as you ticked them, with databases as set under **Restore databases**.

## A Backups page for your customers

When Clokeep has switched the Backups page on for your client, your customers browse their own backups in cPanel and download files, folders, database dumps and mailboxes. They cannot restore, and settings are never included.

On the server's page, under **Backups plugin for customers**, switch on **On for this server** and click **Save changes**. If the note under the switch says it has no effect, the plugin is not switched on for your client. The status reads **Waiting** until the agent first reports, then **Installing**, then **Installed in cPanel**, about a minute later. **Failed** shows the reason, and the agent tries again every 10 minutes. Switch it off and the agent removes it.

Customers find **Backups** in cPanel under **Files**. Downloads work while backup downloads are switched on for your client. Each link works once, for 10 minutes, and the file comes from your storage through the Clokeep panel. Encrypted backups cannot be downloaded there.

To hide the page for some hosting packages, turn off the **Backups** feature (`clokeep_backups`) in WHM's **Feature Manager**. cPanel Team users, webmail users and demo accounts cannot use it.

## Next steps

<CardGroup cols="2">
<Card title="Plesk servers" href="/docs/servers/plesk" icon="layers">
The same features on a Plesk server.
</Card>
<Card title="Agent updates" href="/docs/servers/agent-updates" icon="term">
See which agent version a server runs, and how it updates.
</Card>
</CardGroup>
