Safeguard
Security Guides•

What should you back up from Jenkins home, and what should you skip?

Back up Jenkins configuration, job records and plugins, and keep the controller key out of routine backups. A clear include and exclude list.

Safeguard Security Team
3 min read

Back up the XML configuration files, job and build records and the plugin packages from your Jenkins home directory. Leave out workspaces, the exploded WAR and caches, which rebuild. Keep the controller key and secrets out of regular backups and store them separately in a very secure place.

Why the key is special

Jenkins encrypts stored credentials. The keys to decrypt them live in the secrets directory under Jenkins home, with restrictive file permissions. The credentials documentation says never to include that directory in backups, and to keep a separate copy of the secret so you can restore later. The backup documentation says the same about master.key: store it separately, securely.

The reasoning is simple. If a backup holds both the encrypted credentials and the key, then anyone who gets the backup gets the secrets.

Include and exclude list

Path under Jenkins homeBack up?Why
config.xml and other *.xml filesYesCore configuration
jobs build recordsYesHistory
Archived artifactsIf neededCan be very large
plugins/*.hpi and plugins/*.jpiYesKeeps the plugin versions you use
master.key and secretsSeparately onlyDecrypts credentials
jobs/workspaceNoDo a clean checkout after restore
warNoDownload the latest WAR
cache and toolsNoDownload and extract again
plugins/xxx subdirectoriesNoRepopulate on restart

The simplest approach is to back up the whole directory and handle the key on its own, with the cost being more storage. Selective backups save space but make restores more work.

Steps

  1. Find your Jenkins home. Package installs on Linux use /var/lib/jenkins per the installation docs, and the Docker example uses /var/jenkins_home inside the container.
  2. Pick whole directory or selective backups.
  3. Exclude the secrets from the routine job.
  4. Store the key in a separate secured location with its own access list.
  5. Restore into a test controller at least once, and confirm credentials still decrypt.
  6. Encrypt and restrict the backup storage anyway.

What a test restore proves

A backup you never restored is a guess. A test restore shows whether plugins load, jobs appear and credentials decrypt with the key you stored apart. Do it before an upgrade, not during an outage.

Try it yourself

The demo shows continuous monitoring, which pairs well with a regular backup and restore check.

Click through it at your own pace, or open it full screen.

Where Safeguard fits

Safeguard offers compliance and evidence automation, useful for keeping dated proof that backup and restore checks happened. Try the free scan on a repository too.

Quick check

Should the secrets directory be in my nightly backup?

No. Jenkins documentation says to keep it out of regular backups and store the key separately and securely.

Can I skip the workspace directory?

Yes. Workspaces hold SCM checkouts, and a clean checkout after restore replaces them.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.