You obtain a Jenkins backup configuration by treating "configuration" as three separate layers: the controller's on-disk home directory, the in-application settings exportable through the CLI or UI, and any plugin-owned data. The practical method is to identify JENKINS_HOME on the live controller, copy the XML and properties files that hold global and per-job settings, export job definitions with the thin-backup plugin or CLI if you want a reviewable text form, and then verify every artifact against the running instance. A backup you cannot verify is not a configuration backup; it is a hope.
This guide walks through that sequence for a conventional Jenkins controller, explains why copying the whole home directory is usually the safer baseline, and covers the cases where file-level copying misleads you: encrypted credentials, cloud plugin state, pipeline definitions stored outside Jenkins, and job configuration that lives in Git. Jenkins changes over time, so check the version running on your controller before relying on any plugin-specific path or flag; the paths and file names described below are the long-standing layout, but plugin behavior and CLI syntax are version-sensitive.
Prerequisites and what "configuration" actually covers
Before copying anything, establish four things.
First, the exact value of JENKINS_HOME on the controller. It is printed on the Manage Jenkins → System Information page and also appears in the startup log. On many Linux packages it defaults to /var/lib/jenkins or /var/jenkins_home in the official container image; on Windows services it is often C:\Program Files\Jenkins or a JENKINS_HOME environment variable set at install time. Do not assume; read it.
Second, the Jenkins version and the plugin inventory. Plugin versions determine where job configuration lives (freestyle projects in config.xml versus pipeline jobs referencing a Jenkinsfile) and whether newer configuration-as-code plugins are in play.
Third, whether the instance is a standalone controller or uses a controller/agent topology. Only controller-side configuration needs backing up for a full restore; agent workspaces generally do not, though you may want to record agent definitions (which live on the controller anyway).
Fourth, access. Reading JENKINS_HOME usually requires shell access as the Jenkins service account or root, plus a Jenkins administrator account for CLI and UI exports. Decide in advance whether the backup will be a full filesystem snapshot or a curated export; they serve different purposes.
The layers you are collecting are:
Global configuration: system settings, security realm, authorization strategy, global tool installations, environment variables, and plugin configuration, mostly in config.xml and per-plugin directories under JENKINS_HOME. Job and folder configuration: each item's config.xml, stored under its directory in jobs/. Credentials: encrypted material in credentials.xml plus the master key and, in current Jenkins, the per-instance keys under secrets/. Plugin-specific state: files under plugin directories such as nodes/, users/, and plugin-created subdirectories.
Everything below is about obtaining that material. Restoring it is a separate exercise.
Step 1: Identify, snapshot, and stage the home directory
Do not export files from a running controller while jobs are writing to them, or you can capture a torn configuration. The standard safe approach:
1: Confirm JENKINS_HOME from Manage Jenkins → System Information. 2: Put Jenkins into a quiet state: Manage Jenkins → Prepare for Shutdown stops new builds while letting running ones finish. Alternatively, stop the service (systemctl stop jenkins or the Windows service console) if a full cold copy is acceptable. 3: Copy the entire directory to a staging location on a different disk, or take a filesystem-level snapshot if your storage supports it. A cold copy is the most faithful method; a live copy risks inconsistency but is often used for large instances with a brief quiet period. 4: Record the Jenkins version and the list of installed plugins with versions, from Manage Jenkins → Plugins → Installed plugins. Save that list next to the copy; it is the fastest way to reconstruct a compatible environment later.
What success looks like: the staged copy includes config.xml, jobs/, users/, secrets/, nodes/, plugins/ (or at least the plugin list), and the war or installation marker files. Check that the staging copy's file count and size roughly match the source, and that config.xml opens as valid XML.
The full-directory copy is the recommended baseline because it captures global configuration, job XML, credentials, and plugin state in one pass. The XML-only approaches below are for cases where you need a smaller, reviewable, or version-controllable artifact.
Step 2: Export global settings and job definitions as text
Jenkins exposes two supported text export paths, plus the "read the XML directly" path.
The CLI. Jenkins ships a CLI client (jenkins-cli.jar) reachable via SSH or the remoting channel. The command get-job prints a job's config.xml to standard output, which you can redirect to a file. For a whole instance you would loop over job names. The CLI requires authentication and, on current versions, appropriate permissions; check the help output for your version because flags and transport options have changed over releases.
The Configuration as Code plugin. If installed, the jenkins.yaml file and its export command give you a human-readable representation of many global settings. Do not assume completeness: coverage depends on which plugin and Jenkins features the plugin understands, and some settings may not be exportable. Treat the YAML as a companion artifact, not a replacement for config.xml.
Direct file reads. For most freestyle jobs, the file at JENKINS_HOME/jobs//config.xml is the configuration. Folder-type items nest further (jobs//jobs//config.xml). Reading these files directly is the most complete method, and it is what the CLI returns anyway.
A realistic loop, run as the Jenkins user, that stages every job's XML into a dated directory:
This captures job XML but not the surrounding directory structure's non-XML files. Success check: the staged tree mirrors the source layout under jobs/, and a spot-checked file parses as XML (xmllint --noout or an equivalent). If a job's configuration is defined in a Jenkinsfile in source control, the XML will still exist but will reference the repository and branch, not contain the pipeline. In that case the "configuration" for that job is the Jenkinsfile in Git plus the small XML that points to it; back up both.
Step 3: Capture credentials and their encryption keys correctly
Credentials are the part most often backed up wrongly. In JENKINS_HOME:
credentials.xml holds credential definitions, but secrets inside it are encrypted. secrets/master.key and the other files in secrets/ are the decryption material. Newer Jenkins versions also use secrets/hudson.util.Secret and per-instance key files. Losing these makes the credentials unrecoverable even if credentials.xml is intact. Backing up credentials.xml without secrets/ produces a file that looks fine and decrypts to nothing useful.
So the rule is: copy credentials.xml and the entire secrets/ directory together, and store them with the same care as any secret store. Encrypt the backup at rest and restrict access. If you use an external credentials provider (a secrets manager plugin), the authoritative definition lives outside Jenkins; record the provider configuration and references, and confirm the provider's own backup plan rather than assuming the Jenkins copy is sufficient.
Also capture users/ (user records and API tokens, if you rely on them) and any identity-related configuration. Success check: after restoring to a test instance, log in and resolve at least one credential through a job step without re-entering it. That test proves the key material and the credential file traveled together; without it, you have only a guess.
Step 4: Record plugin-owned, cloud, and agent state
Plugin configuration is split between config.xml and per-plugin files. Common locations worth checking on your instance:
nodes/ (agent definitions and their launch configuration) and the controller's own config.xml. Tool installation records, which reference installer downloads and local tool directories; if you install tools locally, those directories matter too. Cloud plugin state, such as dynamic agent templates, which is usually in config.xml and plugin-specific files. Build history in jobs//builds/. Decide explicitly whether backup includes history. History is usually large and mostly replaceable; if you keep it, say so in the backup contract, because a "configuration backup" without history is not the same artifact.
The failure mode to watch for: a plugin stores secrets or state in a place you did not enumerate. The reliable way to find these is to inventory the top-level directories under JENKINS_HOME and map each to a plugin, then check that plugin's documentation for its storage layout. If you cannot determine a plugin's storage from documentation, the full-directory copy already covers it, which is another reason that is the safer default.
Success check: on a test restore, build one job that exercises a cloud agent or a plugin-specific step and confirm the plugin loads the same settings you exported. A plugin that reads configuration from an external system (Git, a database, a cloud API) will still depend on that external system being reachable and correctly identified; note that dependency in the backup record.
Step 5: Verify the backup before you trust it
Verification is the step that makes the difference between a backup and a copy. Run these checks in order:
1: Integrity: every expected file present, XML files parse, credentials.xml and secrets/ are both present, and the staged copy is readable by the intended restore account. 2: Completeness against the plugin list: the saved plugin inventory matches the plugins referenced in the backup. A plugin installed after the backup is a gap. 3: Restore rehearsal: stand up a test Jenkins with the same version and plugins, restore the staged copy, and check that the configuration loads. This rehearsal is the only real proof; it catches missing key files, plugin mismatches, and settings that Jenkins rejects at startup. 4: Known stop condition: if the test instance refuses to start because of a configuration error you cannot resolve from the log, stop and consult your Jenkins administrator or vendor support before touching the production controller. Do not iterate on a restore against production.
Expect the rehearsal to reveal small gaps on the first attempt. That is normal and is exactly why you rehearse. A backup process that has never been restored is an unverified assumption.
The full-directory copy and the XML-only export: which to prefer
These are not alternatives in every case; they answer different questions.
Full-directory copy captures everything, needs no per-plugin knowledge, and is the best basis for disaster recovery. It is large, contains secrets, is less reviewable, and requires a cold or quiet period for consistency. It is the right default.
XML and text export is small, reviewable in version control, and easy to diff. It misses build history, plugin state outside XML, and any settings the export path does not cover. It is a good companion for tracking configuration changes and auditing what changed between backups, not a substitute for the full copy.
A workable arrangement uses both: nightly full-directory snapshots for restore, plus a version-controlled set of config.xml files and the plugin inventory for change review. The trade-off is operational overhead against recoverability, and the full copy wins on recoverability.
Edge cases that break naive backups
Pipeline jobs with Jenkinsfiles in Git. The XML is tiny and the real logic is elsewhere. Back up the XML and record the repository, branch, and credential references. Restoring the XML without the repository is a job that cannot run.
External configuration systems. If the instance is managed by an infrastructure-as-code tool, the authoritative configuration may be the code repository, and the running instance is a rendered output. Obtain the code repository too, or the backup reflects only a moment that the code will overwrite on the next run.
Containerized controllers. If Jenkins runs in a container with an ephemeral filesystem, the "home directory" may be a volume. Confirm the volume is the thing being copied; copying the container layer gives you nothing durable.
Version drift. A backup taken on one Jenkins version restored onto another can fail on plugin compatibility or configuration schema changes. Keep the version and plugin inventory with the backup so the restore target can be matched.
FAQ
Can I just copy config.xml and call it a backup? No, that covers global settings and misses credentials keys, job XML, and plugin state. Copy at least config.xml, jobs/, credentials.xml, and all of secrets/, or the whole home directory.
Does the CLI export replace the file copy? It returns job XML, which is a useful review artifact, but it does not export credentials, keys, or plugin state. Use it alongside a file copy.
How often should I back up? Frequency should follow how often configuration changes. Most teams pair a nightly full copy with a snapshot taken before any large configuration change.
What if secrets/ is missing from an old backup? Treat the credentials as lost. Restore the configuration but re-enter credentials from your secret store; do not assume encrypted strings will decrypt.