Before setting up backups, check the prerequisites. This guide covers Rustic, credentials, and profile configuration.
See the backups CLI reference for command syntax and examples.
Install Rustic
Install Rustic 0.10 or later (with named backup selection) and put rustic on your PATH. To use a different executable, set BACKUP_RUSTIC to its path. The schedule generator requires absolute paths for both Rustic and the Outfitting Manager executable.
On Windows, the CLI requires PowerShell 7 (pwsh.exe) on PATH and never falls back to Windows PowerShell 5.1. Per-job process guards and generated scheduled tasks run through pwsh.exe; backups schedule resolves its absolute path and fails if it is missing. On Windows, backups schedule also requires --launcher, the absolute path of a JScript file the task runs through wscript.exe to start pwsh.exe hidden. Without it, each run would open a focused terminal window. The launcher returns the run’s exit code to Task Scheduler. Its whole content is:
var a = WScript.Arguments, p = [];
for (var i = 0; i < a.length; i++) p.push('"' + a(i) + '"');
WScript.Quit(new ActiveXObject("WScript.Shell").Run(p.join(" "), 0, true));rustic --versionStore credentials
First import or configure a backup profile as described below. You can declare native service names in backups.credentials in outfitting.json and import them, or add this mapping directly to local config.toml. Backup commands refuse incomplete identity or alert settings before accessing the native store. The configuration wizard still opens incomplete configurations so you can migrate them.
[backups.credentials]
access-key = "workstation-backup-access-key"
secret-key = "workstation-backup-secret-key"
repository-password = "workstation-backup-repository-password"
alert-token = "workstation-backup-alert-token"All four logical keys are required, with no defaults or extra keys. Choose distinct, nonblank service names without control characters. Windows names must also be distinct ignoring case. Accepted strings retain their exact spelling. These are native store identifiers, not secret values; the account remains the scheduled OS user’s name. A manifest may declare the names, but secret values stay in the native store, never in outfitting.json or Rustic files.
Explicit manifest import copies its mapping into local config when it imports backup profiles for the current platform. A declared mapping replaces the existing local one; omission preserves it. A manifest containing only another platform’s backups cannot replace these names. After import, local config remains authoritative. nix switch and source refresh do not import settings or rewrite config.
Use backups secrets set to enter credentials in a prompt. The CLI stores them in the OS credential store and supplies repository credentials to Rustic at run time; values are not accepted as command arguments or saved in your repository configuration.
- macOS: Keychain
- Windows: Credential Manager
- Linux: the Secret Service (for example GNOME Keyring), through libsecret
Set these credentials on each machine:
| Secret | Description |
|---|---|
access-key |
Storage access key ID, such as an S3 or Cloudflare R2 key. |
secret-key |
Storage secret access key. |
repository-password |
Password that encrypts the Rustic repository. |
alert-token |
Bearer token for failure and review alerts. |
Configure alerts or explicitly disable them as described below before running these commands. Run secrets check after setting credentials. It verifies all four when alerts are enabled. With alertsDisabled = true, skip secrets set alert-token; checks and backup operations never look up that token, but its service-name mapping remains required.
outfitting-manager backups secrets set access-key
outfitting-manager backups secrets set secret-key
outfitting-manager backups secrets set repository-password
outfitting-manager backups secrets set alert-token
outfitting-manager backups secrets checkKeep the Secret Service unlocked on Linux
On Linux, credentials go through libsecret (libsecret-1.so.0) to a Secret Service provider on the user’s D-Bus session bus. Scheduled runs have no login session, so the provider must already be running and unlocked in the systemd user manager:
- Enable lingering so the user manager and its timers start at boot:
loginctl enable-linger <user>, orusers.users.<name>.linger = trueon NixOS. - Run exactly one secrets daemon as a user service that unlocks itself, for example
gnome-keyring-daemon --foreground --components=secrets --unlockwith the keyring password on standard input. Do not also start a D-Bus-activated or PAM-launched daemon. An empty password keeps the keyring unlocked unattended, but stores it unencrypted at rest, readable by anyone who can read the user’s home directory. - Order the backup service after that unit with
After=andWants=.
On NixOS, the released binary is not a Nix-patched executable. Enable programs.nix-ld.enable = true with programs.nix-ld.libraries = [ pkgs.libsecret pkgs.glib ] so it starts and can load libsecret. Run the daemon from pkgs.gnome-keyring in a Home Manager user service. Do not rely on services.gnome.gnome-keyring.enable on a headless machine: its PAM unlock needs a password login, which key-based SSH and timers never perform, and its D-Bus activation can start a second daemon that is not unlocked.
On other distributions with Home Manager, use the system libsecret. A Nix libsecret on LD_LIBRARY_PATH fails to load against the system glibc, so the generated service unsets LD_LIBRARY_PATH.
Configure a backup profile
Backup profiles are separate from package profiles. Declare a profile in your outfitting.json manifest, then import it into the local config.toml with the configuration wizard. The profile selects Rustic TOML files; those files define the repository, jobs, source folders, and default retention. Outfitting can attach optional policies to those jobs. After import, local config.toml is authoritative; runtime does not reread the manifest.
Declare the profile in outfitting.json
{
"schema": 3,
"profiles": {
"workstation": {
"macos": { "nix": { "flake": "nix", "attribute": "workstation" } }
}
},
"backups": {
"defaultProfile": "personal",
"credentials": {
"access-key": "workstation-backup-access-key",
"secret-key": "workstation-backup-secret-key",
"repository-password": "workstation-backup-repository-password",
"alert-token": "workstation-backup-alert-token"
},
"profiles": {
"personal": {
"platform": "macos",
"files": ["backups/common.toml", "backups/personal.toml"],
"paths": {
"PROJECTS": "${HOME}/Projects",
"PHOTOS": "/Volumes/Archive/Photos"
},
"jobs": {
"photos": { "retention": { "keep-monthly": 3 } }
}
}
}
}
}Replace the package profile with your own declarations. The files paths are relative to the repository. Import the manifest and check the selected profile:
outfitting-manager config wizard \
--manifest system/macos/outfitting.json
# The manifest imports service names; configure local alert settings before checking readiness.
outfitting-manager backups doctorFor a local setup, use schema = 2 and declare the same profile and policies in config.toml. Combine this with the credential mapping above and one of the alert configurations below; do not duplicate TOML table headers:
schema = 2
[backups]
profile = "personal"
[backups.profiles.personal]
platform = "macos"
files = ["backups/common.toml", "backups/personal.toml"]
[backups.profiles.personal.paths]
PROJECTS = "${HOME}/Projects"
PHOTOS = "/Volumes/Archive/Photos"
[backups.profiles.personal.jobs.photos.retention]
keep-monthly = 3Bind source paths explicitly
Use ${PROJECTS} and ${PHOTOS} in Rustic snapshot sources or globs to reference the profile’s paths table. Choose any uppercase names matching [A-Z][A-Z0-9_]*. Source resolution has no cloud-provider, account-name, or localized-folder defaults.
${HOME} is built in on both platforms. Windows also provides ${APPDATA}, ${USERPROFILE}, and ${LOCALAPPDATA} from the scheduled user’s environment, with standard user-directory fallbacks. These names are reserved and cannot be overridden. Custom binding values may reference builtins, but not other custom bindings. Arbitrary environment variables, shell expansion, and recursive substitution are not supported.
Resolved bindings and source paths must be absolute. Windows requires a drive-qualified path such as D:/Photos or a complete UNC path such as \\server\share\Photos; drive-relative paths, root-relative paths, and device namespaces are rejected. Globs may remain relative or negated. Missing or malformed bindings fail before Rustic runs. Composition validates declarations without requiring source folders to exist; doctor does not verify read access.
Path spelling, separators, and Unicode are preserved during substitution. Both interactive and scheduled commands read bindings from the selected profile in the same local config. Editing a manifest alone has no effect. Re-import replaces the current platform’s profile declarations, including paths; ordinary wizard edits preserve them. After changing bindings for a remote source, refresh its validated cache before offline runs.
Choose log locations
Rustic writes rustic.log under ~/Library/Logs on macOS, %LOCALAPPDATA%/rustic on Windows, or ~/.local/state/rustic on Linux. Linux receipts and locks live under ~/.local/state/rustic-backup; both locations ignore XDG_STATE_HOME so they cannot move between a login shell and the systemd user manager. To override the directory, add logDirectory to the local [backups] table, alongside profile:
[backups]
profile = "personal"
logDirectory = "${HOME}/Backup Logs"The override accepts an absolute path and platform builtin substitutions, not profile-specific bindings. doctor shows the resolved log directory and file. Log-only changes do not invalidate the remote source cache or move backup receipts and locks.
Newly generated macOS LaunchAgents use the same directory for rustic-wrapper.log and rustic-wrapper.error.log. Create that directory before loading the LaunchAgent: launchd opens these files before starting the CLI. Generation remains print-only. Existing installed schedules are not updated, and their captured stdout/stderr paths do not change until explicitly regenerated and installed.
Configure alerts or explicitly disable them
Set alertUrl under the local [backups] table, alongside profile. There is no default endpoint or legacy payload fallback. If this setting is absent, backup commands refuse to run until you configure alerts or explicitly disable them.
[backups]
profile = "personal"
alertUrl = "https://alerts.example.com/v1/alerts"Use your service’s canonical HTTPS URL with exactly the path /v1/alerts. URL credentials, queries, fragments, trailing slashes, and encoded or path-normalized aliases are rejected. The CLI has no host or platform-route allowlist. This is local manager configuration, not an outfitting.json or Rustic setting. Wizard edits and manifest re-import preserve the endpoint. Scheduled invocations read the same config file.
All jobs in the selected profile use the configured endpoint and alert-token service name; there are no per-job credentials, selector headers, or fan-out. Store the service’s token using outfitting-manager backups secrets set alert-token, not in TOML or environment variables. Equal service names on separate devices do not imply shared token values.
Canary uses the exact raw bearer token to select a credential policy in its live ServiceCatalog KV. An operator manually creates credentials/<digest>, where the digest is lowercase hexadecimal SHA-256 of the token’s UTF-8 bytes, without trimming or a trailing newline. The policy owns the sender and the complete recipient list; every configured recipient is included in the send. There is no caller inventory, per-caller secret binding, caller manifest, or required provisioning automation.
When upgrading from /v1/alerts/<slug>, change alertUrl to the generic route and remove alertSender and alertRecipient before running the new CLI or wizard. Obsolete keys are rejected, not ignored. Refresh the validated remote source cache with outfitting-manager init after changing the endpoint. Existing native token storage and service names are unchanged. A token can be retained only if it meets Canary’s 32–512 printable-ASCII limit and the operator registers its exact digest; otherwise rotate it privately. Prefer independently generated cryptographic 256-bit tokens.
Coordinate this migration with Canary’s deployment: the old Worker and new client contracts are incompatible. Operators must retain a registry snapshot, review the cutover/recovery plan, and onboard the sender’s domain on Workers Paid for any-recipient sending. Start the new policy disabled, verify generic 401 after provisioning, then enable it when ready. KV changes can take 60 seconds or more to propagate; old services/<slug> records are ignored by the new Worker, and deployment does not create or reconcile credential policies. See Canary’s operator guide for the policy schema and manual onboarding/rotation procedure.
To disable alerts instead, omit alertUrl and set:
[backups]
profile = "personal"
alertsDisabled = trueOpt-out is mutually exclusive with alertUrl. It skips alert delivery and all alert-token lookups, including secrets check. Keep all four keys in [backups.credentials]. Changing credentials, scheduleLabel, or alertsDisabled does not invalidate the source cache. The alert endpoint remains part of the source hash; refresh the validated remote cache after changing it.
The CLI sends POST to the configured endpoint using Content-Type: application/json and Authorization: Bearer <alert-token>. The JSON contains only title, message, an ISO timestamp with Z, and metadata: { hostname, operation, job } for job failures or review-required candidates. No sender, recipient, severity, source, or top-level identity fields are sent; Canary rejects unknown top-level fields. The title puts the operation and job name before the hostname so a long hostname cannot truncate the job. Repository-wide/check failures use the same endpoint and token, with metadata: { hostname, operation } and no invented job name. The job is descriptive, not an authorization boundary. An exit code is omitted because local validation failures do not always have one.
The CLI strips NUL from messages, keeps its existing 4,000 UTF-16-unit message cap, and bounds control-free titles to 200 UTF-16 units. It rejects serialized bodies over 32,768 actual UTF-8 bytes locally, including metadata. Only HTTP 202 with { "sent": true, "message_id": "..." } and a nonempty ID confirms provider acceptance, not inbox delivery.
Rejected responses never confirm acceptance: 400 indicates invalid payload, 401 an invalid/missing token or missing/disabled policy, 404 a wrong route, 413 an oversized body, 415 unsupported media or encoding, 502 provider failure, and 503 a malformed policy or unavailable KV. Fix configuration or provisioning rather than retrying rejected requests.
Requests have a 20-second timeout, no automatic retry, and no idempotency guarantee. A timeout can occur after provider acceptance; retrying manually or on a later failed backup may duplicate email. Alert errors only log a warning and never replace the backup result.
After enabling the credential policy and allowing for propagation, verify a controlled request with the service’s provisioned token, checking HTTP 202 and separately checking every intended inbox. Do not deliberately fail a real backup. Installing this CLI does not deploy a service, write live KV, edit live host settings or credentials, or replace schedules. Those actions and any native credential approval remain manual.
Configure the Rustic TOML files
The declared TOML files specify the repository, retention policy, and source folders.
The names project-data and photos below are examples, not defaults. Choose names for your own jobs; the source folders and policies determine what each job backs up and how it behaves.
[repository]
repository = "opendal:s3"
[repository.options]
bucket = "my-backup-bucket"
endpoint = "https://<account-id>.r2.cloudflarestorage.com"
region = "auto"
[forget]
keep-daily = 7
keep-weekly = 4
keep-monthly = 12
[[backup.snapshots]]
name = "project-data"
sources = ["${PROJECTS}"]
tags = ["project-data"]
skip-if-unchanged = true
[[backup.snapshots]]
name = "photos"
sources = ["${PHOTOS}"]
tags = ["photos"]
skip-if-unchanged = trueSet the profile’s path bindings to your actual absolute folders. Literal absolute source paths are also supported.
Every [[backup.snapshots]] entry creates a job, in composition order. There is no built-in job list on either platform. Declare at least one snapshot with a unique name. Names use 1–64 lowercase ASCII letters, digits, _, or -, starting with a letter or digit. check and Windows device names such as con are reserved.
Use the snapshot’s name in CLI job arguments and any matching jobs policy key. Tags must include that same name and must not include another configured job’s name, commas, control characters, or surrounding whitespace. Other annotation tags can be shared.
Back up more often than daily
By default each job is due once per local day. Set intervalHours on the profile to one of 1, 2, 3, 4, 6, 8, or 12 for shorter slots, anchored at the platform’s daily hour (10:00 on macOS, 09:00 on Windows, 00:00 on Linux). A job is due when nothing was accepted since the current slot started. Slots wrap across midnight, so a missed slot catches up on the next wake-up.
[backups.profiles.agent]
platform = "linux"
files = ["backups/common.toml", "backups/agent.toml"]
intervalHours = 6Retention can keep everything recent with Rustic’s keep-within, such as keep-within = "4d" in [forget] or a job’s retention. Rustic measures it from the job’s latest snapshot. Accepted spans are a positive whole number followed by h, d, w, or y, or a spelled-out unit such as 4 days. To replace inherited counters, set them to 0.
Prepare consistent copies with Rustic hooks
A snapshot may declare Rustic hooks that run only around its own backup: hooks = { run-before = ["command args"] }, plus run-after, run-failed, and run-finally. Commands use Rustic’s short string form and resolve through PATH. A failing run-before command fails that backup, and nothing is accepted. Hook standard output is mixed into Rustic’s JSON result, so hook commands must write nothing to standard output; send diagnostics to standard error. Use a hook to stage consistent copies of live databases, back up the staging directory, and exclude the live files with globs.
Attach optional job policies
The jobs map attaches policies to existing TOML snapshots; it does not create jobs. Unknown job references or policy fields are errors. Jobs without policies inherit [forget] and have no process guard.
retentionoverrideskeep-within,keep-daily,keep-weekly, andkeep-monthlyindividually. Omitted counters inherit the TOML default;0disables a counter and-1keeps all qualifying period representatives. Each job needs at least one enabled counter. Globalkeep-idpins and recovery anchors remain protected.skipIfProcessesRunninglists up to 32 exact Windows process basenames without.exe, paths, or wildcards. Matching ignores case. Names use letters, digits,.,_, or-, start with a letter or digit, and are at most 128 characters. Process guards are currently Windows-only; macOS rejects nonempty lists.
For a Windows profile with a project-data snapshot, add:
[backups.profiles.workstation.jobs.project-data]
skipIfProcessesRunning = ["ExampleEditor", "Editor_Helper"]Run schedules with the right permissions
- The account running a backup needs read access to every source folder.
- Run the LaunchAgent or scheduled task as the same logged-in user who stored the credentials. On Windows, the user must remain logged in; a locked session is fine.
- On Linux, install the systemd user service and timer for the user who stored the credentials, with lingering enabled and the Secret Service unlocked as described above.