Skip to Content
Zerobyte
Guides

Remote agents

Back up files from another Linux machine with Zerobyte.

Unreleased feature

Remote agents are still in development and aren't available in a stable Zerobyte release. This guide describes the upcoming feature. Installation commands will work once the installer and agent binaries are published.

A remote agent lets Zerobyte back up files on another machine without mounting its folders on the Zerobyte server. The agent runs Restic on that machine and sends backups directly to your repository. You manage the sources and backup schedules from Zerobyte as usual.

The agent connects to Zerobyte, so you don't need to open an inbound port on the remote machine. It must be able to reach both your Zerobyte server and the backup repository.

Before you start

On the machine you want to back up, you'll need:

  • Linux on x64 or ARM64, with glibc and systemd.
  • Restic 0.18.0 or newer, installed on the service's PATH, such as /usr/bin/restic or /usr/local/bin/restic.
  • Sudo access to install and manage the agent service.

The agent is a standalone executable. You don't need to install Bun. The installer doesn't support Alpine Linux, macOS, or Windows.

Your Zerobyte server should have an HTTPS address that the remote machine can reach. Remote agents are available in the server version of Zerobyte, not the desktop app.

Enable remote agents

Add the following environment variable to your Zerobyte service and restart it:

environment:
  ENABLE_REMOTE_AGENTS: "true"

Set BASE_URL to the HTTPS address you use to access Zerobyte. If a reverse proxy handles HTTPS, also set TRUST_PROXY=true and enable WebSocket forwarding. See the reverse proxy guide for configuration examples.

Connect a machine

  1. Open Settings, choose your organization, and find Machines.
  2. Click Connect machine, give the machine a name, and click Continue.
  3. Choose Linux installer, copy the command, and run it in a terminal on that machine.
  4. Keep the setup page open. It advances to Connection successful once the agent is connected and ready. Review its allowed locations, then create a source.

The command downloads the agent, checks its checksum and Restic installation, then installs a systemd service. The agent starts immediately and starts again after a reboot. Once it connects, its status in Zerobyte changes to Online.

The connection code in the command can be used once and expires after 15 minutes. If it expires, get a new command from the machine's Actions menu.

Run with Docker

The agent image is published at ghcr.io/nicotsx/zerobyte-agent for Linux AMD64 and ARM64. Use the same version tag as your Zerobyte server, such as vX.Y.Z. Stable releases also have latest, major, and minor tags; branch builds use sha-<commit> tags.

The image contains the standalone agent, Restic, CA certificates, and an SSH client for SFTP repositories. It runs in the foreground without systemd. Mount the directories you want to back up from the host; network filesystems should be mounted on the host first.

In Settings → Machines, connect a machine and choose the Docker tab. Copy its prefilled configuration into compose.yaml on the machine you want to back up. It includes the controller address and a single-use connection code:

services:
  agent:
    image: ghcr.io/nicotsx/zerobyte-agent:vX.Y.Z
    hostname: remote-agent
    restart: unless-stopped
    environment:
      ZEROBYTE_CONTROLLER_URL: "https://zerobyte.example.com"
      ZEROBYTE_AGENT_ENROLLMENT_CODE: "YOUR_CONNECTION_CODE"
      ZEROBYTE_AGENT_ROOTS: >-
        [{"id":"files-1","label":"Files","path":"/data","allowBackup":true}]
    volumes:
      - agent-config:/var/lib/zerobyte-agent
      - agent-cache:/var/cache/zerobyte-agent
      - /path/on/host:/data:ro

volumes:
  agent-config:
  agent-cache:

Replace /path/on/host with the directory you want to back up, then start the service before the code expires:

docker compose up -d

The agent enrolls automatically on first startup and saves its machine credential in the configuration volume. Restarts reuse that credential without consuming the connection code again. Once the machine is Online, you can remove ZEROBYTE_AGENT_ENROLLMENT_CODE from the YAML. Keep the configuration volume across container upgrades. The cache volume avoids downloading repository metadata again after recreation. No published ports or privileged mode are needed.

Manage allowed locations through ZEROBYTE_AGENT_ROOTS in Compose, then recreate the container. Use container paths, and mount each path you share:

environment:
  ZEROBYTE_AGENT_ROOTS: '[{"id":"files-1","label":"Files","path":"/data","allowBackup":true}]'

Keep existing root IDs when changing paths so sources continue to reference the same location. Use docker compose logs -f agent for logs. For upgrades, follow the manual update instructions.

To reconnect an existing container, use that machine's Actions → Get connection command, confirm the reconnect warning, and choose Docker. Replace the enrollment code in your existing YAML and run docker compose up -d --force-recreate. Preserve your configuration volume and allowed-location settings; the fresh code reconnects the same machine.

Allow insecure HTTP connections

HTTPS is required by default. If you deliberately use an HTTP controller, set ZEROBYTE_AGENT_ALLOW_INSECURE_HTTP=true on both the Zerobyte server and the remote agent, then restart both. Set the server's BASE_URL to its reachable HTTP address.

For Docker agents, use:

environment:
  ZEROBYTE_CONTROLLER_URL: "http://zerobyte.example.com"
  ZEROBYTE_AGENT_ALLOW_INSECURE_HTTP: "true"
  ZEROBYTE_AGENT_ENROLLMENT_CODE: "YOUR_CONNECTION_CODE"

The option applies to initial enrollment, reconnection, and agents using ZEROBYTE_AGENT_TOKEN directly. With a token, ZEROBYTE_CONTROLLER_URL accepts an HTTP/HTTPS controller address or a WS/WSS connection URL. The option defaults to false; only the exact value true enables it. It does not disable HTTPS certificate verification.

For a Linux service, set the variable when running the installer (after sudo env) to allow HTTP enrollment. The saved controller address is reused on service restarts. The existing --allow-insecure CLI option also allows HTTP enrollment.

HTTP sends machine credentials and controller traffic, including repository credentials, without TLS encryption. Settings → Machines shows an Insecure HTTP badge and a warning on connected machines using HTTP. Offline machines retain a warning about their last connection. Use HTTPS to protect the connection.

Choose folders to back up

With the Linux installer, a newly connected agent doesn't share any folders. On the remote machine, run:

sudo zerobyte-agent folders add

Use the folder picker to select the directories you want Zerobyte to access. You can choose several folders and run the command again later to add more. The agent restarts after you add folders, so do this between backup runs.

The selected folders appear as Allowed locations on the machine's card in Zerobyte. You can also list them from the terminal:

sudo zerobyte-agent folders list

Zerobyte can browse and back up files inside these locations. Files outside them aren't available through the agent.

Create a backup

In Sources, create a source and choose Another machine. Select your connected machine and an allowed location. You can back up the whole location or browse to a folder inside it.

Save the source, then create a backup job using it. Choose a repository that the remote machine can reach and set your schedule. Local and rclone repositories aren't available for remote sources because they rely on paths or configuration on the Zerobyte server.

Restores currently run on the Zerobyte server. To recover files from a remote backup, restore them to a custom location on the server or download them, then copy them back to the remote machine.

Check the agent

The machine's card shows its status, last contact, hostname, platform, and allowed locations. Agents that report version information also show their agent and Restic versions.

On the remote machine, use these commands to check the service and follow its logs:

sudo zerobyte-agent status
sudo zerobyte-agent logs --follow

Press Ctrl+C to stop following the logs. The agent keeps running in the background. You can also use start, stop, and restart to manage the service.

If the connection drops, the agent retries automatically. The delay increases between failed attempts, up to roughly 30 seconds.

Update the agent

Open Settings → Machines to see which agents have updates. Update required means the agent is too old for this server and backups from that machine are blocked. Update available means the agent is compatible and you can upgrade when convenient.

Choose Update agent on a supported Linux systemd installation connected over HTTPS. Zerobyte verifies signed GitHub release attestations before offering remote updates. The server and agent need outbound HTTPS access to the release downloads and to tuf-repo-cdn.sigstore.dev for Sigstore trust metadata. The request stays queued until the agent checks in, even when Machines shows it as offline or its protocol is too old for backups. The agent lets running jobs finish before replacing its executable and restarting the service. Zerobyte marks the update Completed when the updated agent reconnects. If the update fails, you can retry from Machines when the release is still offered.

Manual updates

If Machines shows How to update, follow the instructions for your installation and use the target version shown there when available.

  • Docker Compose: Change the agent image tag in your Compose configuration to match the Zerobyte server. Use the published release tag for a release server or nightly for a nightly server. Between backup runs, run docker compose pull agent and docker compose up -d agent from the directory containing the Compose file. Keep the existing configuration volume and allowed-location mounts.
  • Linux systemd: An installation that predates the managed updater needs one manual upgrade before you can request future updates from Machines over HTTPS. Update between backup runs, using the installer without a connection code.

For Linux systemd, pin a published release tag with Linux agent binaries that matches your Zerobyte server. Use the target shown in Machines when it matches a published release. Replace vX.Y.Z with that release tag:

curl -fsSL https://zerobyte.app/install.sh | sudo env ZEROBYTE_AGENT_VERSION=vX.Y.Z bash

For a nightly server, use the matching nightly Docker agent, or run a published Zerobyte server release with its matching published Linux agent if you need systemd.

The installer preserves the machine's connection and allowed locations, then restarts the service.

If you've downloaded a new agent executable yourself, run its install command without a connection code to update the existing installation. A connection code is only needed for first-time setup or reconnection.

Reconnect or revoke a machine

To replace a machine's credential, open its Actions menu in Zerobyte and choose Get connection command. Run the new command on the same machine. The agent detects its saved identity and reconnects automatically, preserving the allowed locations and existing sources.

Generating that command disconnects the current agent and invalidates its old credential. Do this between backup runs, and keep the saved configuration at /var/lib/zerobyte-agent/agent.json so the new command can reconnect the existing installation.

Choose Revoke connection to prevent a machine from connecting. Its sources and backup schedules remain saved. To use the machine again, reconnect it from the same machine card.

Troubleshooting

The installer says the machine is already enrolled

The machine already has a saved identity. To update it, run the installer again without a connection code, as described in Update the agent.

If you need to replace the credential, choose Get connection command from the existing machine's Actions menu and run its new command. Keep agent.json; deleting it also loses the saved folder selection.

Enrollment fails with “TLS required”

Check that the controller URL uses HTTPS. When a trusted proxy terminates HTTPS and forwards to Zerobyte over HTTP, set TRUST_PROXY=true on Zerobyte and make sure the proxy forwards the original secure protocol.

The machine stays offline after installation

Check sudo zerobyte-agent logs --follow. Your proxy must allow WebSocket upgrades to /api/v1/agents/connect and preserve the Authorization header. With TRUST_PROXY=true, Zerobyte accepts X-Forwarded-Proto: https and X-Forwarded-Proto: wss for secure connections.

If the logs report a Restic or configuration error, fix it and run sudo zerobyte-agent restart. These errors stop the service until you restart it.

The machine is online but has no allowed locations

Run sudo zerobyte-agent folders add on the remote machine. Registering a machine doesn't share its filesystem automatically.