# Leaving Zefily

> Remove the agent from a server and keep a standard, working stack — and what to set up instead.

You can stop using Zefily at any time without breaking your sites.

## Remove the agent from a server

On the server's overview, **Remove Zefily from this server → Remove…**, type the server's name and approve with your passkey. The agent uninstalls itself and nothing else: nginx or OpenLiteSpeed, PHP, databases, your sites and their certificates, cron entries, daemons, the firewall and the SSH hardening keep working as plain system services of a standard Ubuntu or Debian setup that any administrator can manage. The server then shows as removed in the panel; **Delete this server** removes its record.

To connect the server to Zefily again later, open it while it is offline and follow **Reconnect the agent** on its page: run the command it shows on the server, and the server keeps its sites and history. See [Connect a server](/docs/connect-a-server).

## Without the panel: uninstall on the server

If the server is offline, or you already deleted it in the panel, run this as root on the server:

```bash
sudo zefily-agent uninstall
```

Without `--yes` the command only checks: it lists what it would hand over, what stops, what stays and what it would remove, and changes nothing. Add `--yes` to remove the agent. `--dry-run` does the same as the plain check.

The agent renews the Let's Encrypt certificates of your sites itself, so the command hands that renewal to **certbot**, the ACME client of your distribution (https://eff-certbot.readthedocs.io/en/stable/). The removal never waits for a certificate: it finishes in seconds, and your sites keep serving their current certificates without interruption until those expire.

1. It installs certbot from the distribution if it is missing. It needs certbot 1.10.0 or newer, the first release with the options it uses (https://raw.githubusercontent.com/certbot/certbot/main/certbot/CHANGELOG.md). Packaged versions meet that: Debian 12 2.1.0 (https://packages.debian.org/bookworm/certbot), Ubuntu 24.04 2.9.0 (https://packages.ubuntu.com/noble/certbot), Debian 13 4.0.0 (https://packages.debian.org/trixie/certbot) and Ubuntu 26.04 4.0.0 (https://packages.ubuntu.com/resolute/certbot). An older certbot stops the command and names the reason; install a newer one with the official instructions (https://eff-certbot.readthedocs.io/en/stable/install.html) so that `/usr/bin/certbot` reports 1.10.0 or newer, then run the command again.
2. It enables the systemd timer `zefily-cert-renew.timer`, which runs `certbot renew` twice a day. A certbot deploy hook copies every issued or renewed certificate to `/etc/zefily/ssl/<site>`, where your web server already reads it, and reloads the web server. Your vhosts do not change.
3. It starts the background hand-over `zefily-cert-handover`, a small systemd service that runs on certbot and systemd alone, after the agent is gone. It issues each site's certificate once through certbot from Let's Encrypt, with a new key. A site that fails is retried once a day until seven days before its current certificate expires. When every site is done, the service removes itself.

The command lists the sites it hands over and the date until which each current certificate is valid. Follow the hand-over with `systemctl status zefily-cert-handover` and the log `/var/log/zefily-cert-handover.log`; a site that could not be handed over in time is named there, and you can then issue its certificate with certbot yourself.

If setting this up fails, the command stops, names the reason and takes back what it changed: the files it wrote, the timers it enabled and a certbot package it installed. Your agent keeps renewing as before. certbot cannot reuse the agent's ACME account or the current key, so the hand-over opens a new Let's Encrypt account. Sites with a ZeroSSL or Google Trust Services certificate (HTTP-01) are handed over too, to Let's Encrypt: certbot cannot use those CAs without their external account keys, so their certificate comes from Let's Encrypt from then on. The check and the removal name each such site ("moves from zerossl to Let's Encrypt"). DNS-01 certificates (wildcards or a DNS provider) are not handed over yet: the command names those sites and removes nothing. Move those sites to HTTP-01 first. Certificates you supplied yourself are yours, and nothing renews them.

A real removal stops and disables the agent, then removes its program and service unit, its trust bundle, its keys and enrollment (in `/var/lib/zefily-agent`), the apt source and key for apt.zefily.com and its system user. Running it again finds nothing left to remove.

Certificates left in `/etc/zefily/ssl` for a site that is no longer on the server (from an earlier removal) are not handed over: the command removes them, since nothing serves them. It keeps everything else: the web server, PHP, Node.js and Python, databases and their data, your sites and their files, `/home`, backups and their keys, the certificates of your sites in `/etc/zefily/ssl`, SSH settings and `authorized_keys`, your users' sudo rules, and the cron, daemon, firewall and tunnel units. Packages from apt.zefily.com, such as zefily-nginx, stay installed but get no more updates.

An agent installed before this command existed has none. Remove the server from the panel while it is online, or contact support.

To move a server to another Zefily account, run the uninstall command on it, then run the new account's install command. The new account does not see the old sites, databases or users; they stay on the server as they were.

## What stops with the agent

| Stops | Set up instead |
| --- | --- |
| Certificate renewal | Handed to certbot in the background, without waiting; current certificates keep serving; ZeroSSL and Google sites move to Let's Encrypt; DNS-01 certificates must be moved first |
| Scheduled backups to your storage | `restic` with the repository and password from the backup plan (your snapshots stay readable) |
| Deploys, the panel's terminal, files and monitoring | Your own deployment and monitoring tools |
| Automatic tuning | Nothing needed: the last tuned settings stay |

Automatic security updates keep running — they are part of the system, not the agent.

## Closing your account

Cancel your subscription in **Billing**, remove the agent from your servers, then delete your account under **Settings → Profile**. If you own an organization that still has members or servers, transfer ownership to another member first (**Settings → Team → Make owner**). Deleting the account also cancels the subscription of each organization you alone own, at the end of its current period. An organization you alone own that is empty (no members, no servers) is closed: its name, invitations, API tokens, webhooks, provider and DNS credentials and other settings are removed, while billing and invoice records and the audit history stay, as the law requires.

---
Source: https://zefily.com/docs/leaving-zefily
