LockBox CLI documentation
LockBox CLI is the English-only automation build for scripted encryption, extraction, activation, scheduled encrypted backups, and CI/CD workflows. It uses the same device-bound license model as the desktop app.
Quick start
Put LockBox.Cli.exe in a folder included in PATH,
or call it by full path. The --cli marker is accepted for compatibility
but is not required in the CLI-only build.
.\LockBox.Cli.exe --help
.\LockBox.Cli.exe device-id
.\LockBox.Cli.exe algorithms
.\LockBox.Cli.exe keygen --count 3
Minimal create and open workflow:
$env:LBX_MASTER = "use-a-long-master-password"
$env:LBX_L1 = "layer-1-key"
.\LockBox.Cli.exe create `
--source "D:\Data" `
--output "E:\Backups\data.lbx" `
--master-env LBX_MASTER `
--layer-env AES-128-GCM=LBX_L1
.\LockBox.Cli.exe open `
--container "E:\Backups\data.lbx" `
--output "D:\Restore" `
--master-env LBX_MASTER `
--key-env LBX_L1
Linux uses the same commands with slash paths and a binary without the .exe suffix:
chmod +x ./LockBox.Cli
./LockBox.Cli --help
./LockBox.Cli device-id
./LockBox.Cli create \
--source "/srv/data" \
--output "/backup/data.lbx" \
--master-env LBX_MASTER \
--layer-env AES-128-GCM=LBX_L1Install and verify the CLI
Extract the ZIP for your operating system and CPU. The executable includes .NET. Compare the package hash with SHA256SUMS.txt. The following recipes assume the executable has been placed at the absolute path shown in the next section; check help and license under the account that will run backups.
Linux also needs the distribution's native dependencies, including ICU and OpenSSL; bundled .NET does not supply them. On Windows, PowerShell scripts must be allowed by the effective execution policy.
.NET / Linux · PowerShell / ExecutionPolicy
Expand-Archive -LiteralPath '.\LockBox-Cli-win-x64.zip' -DestinationPath 'C:\Tools\LockBox'
& 'C:\Tools\LockBox\LockBox.Cli.exe' --help
& 'C:\Tools\LockBox\LockBox.Cli.exe' license
Get-FileHash -LiteralPath '.\LockBox-Cli-win-x64.zip' -Algorithm SHA256uname -m
unzip LockBox-Cli-linux-x64.zip -d ./lockbox-cli
chmod +x ./lockbox-cli/LockBox.Cli
./lockbox-cli/LockBox.Cli --help
./lockbox-cli/LockBox.Cli license
sha256sum LockBox-Cli-linux-x64.zipWindows x64 -> LockBox-Cli-win-x64.zip
Windows x86 -> LockBox-Cli-win-x86.zip
Windows ARM64 -> LockBox-Cli-win-arm64.zip
Linux x86_64 -> LockBox-Cli-linux-x64.zip
Linux aarch64 -> LockBox-Cli-linux-arm64.zip
Linux armv7l -> LockBox-Cli-linux-arm.zipFolders, paths and storage
Replace the example paths with your own. The source must be a nonempty folder; the container must be outside it. Reusing an output name replaces the previous container and its parts. Reserve space for temporary files beside the container, plus a source copy for scheduled jobs. Size units use powers of 1024; padding adds bytes, not a target total size.
C:\Tools\LockBox\LockBox.Cli.exe /opt/lockbox/LockBox.Cli
C:\LockBox\secrets\master.txt /srv/lockbox/secrets/master.txt
C:\LockBox\secrets\layer1.txt /srv/lockbox/secrets/layer1.txt
C:\LockBox\backup.ps1 /srv/lockbox/backup.sh
D:\Data\report.csv /srv/data/report.csv
E:\Backups\20260910-020000\data.lbx /backup/20260910-020000/data.lbx
D:\Restore\Data\report.csv /restore/data/report.csv& 'C:\Tools\LockBox\LockBox.Cli.exe' create --source 'D:\Data' --output 'E:\Backups\data.lbx' --master-file 'C:\LockBox\secrets\master.txt' --layer-file 'AES-128-GCM=C:\LockBox\secrets\layer1.txt'/opt/lockbox/LockBox.Cli create --source /srv/data --output /backup/data.lbx --master-file /srv/lockbox/secrets/master.txt --layer-file AES-128-GCM=/srv/lockbox/secrets/layer1.txtPrepare reusable secret files
Generate secrets once, keep a protected backup and restrict file access to the backup account. These examples refuse to replace existing keys. Secret files use UTF-8; trailing line breaks are removed, spaces are preserved. Never regenerate keys before opening older backups.
$ErrorActionPreference = 'Stop'
$cli = 'C:\Tools\LockBox\LockBox.Cli.exe'
$secretDir = 'C:\LockBox\secrets'
New-Item -ItemType Directory -Force -Path $secretDir | Out-Null
$files = @('master.txt', 'layer1.txt')
foreach ($name in $files) {
if (Test-Path -LiteralPath (Join-Path $secretDir $name)) {
throw "Secret already exists: $name"
}
}
foreach ($name in $files) {
$key = & $cli keygen --count 1
if ($LASTEXITCODE -ne 0) { throw 'Key generation failed' }
[IO.File]::WriteAllText((Join-Path $secretDir $name), [string]$key, [Text.UTF8Encoding]::new($false))
}set -eu
umask 077
mkdir -p /srv/lockbox/secrets
test ! -e /srv/lockbox/secrets/master.txt
test ! -e /srv/lockbox/secrets/layer1.txt
set -C
/opt/lockbox/LockBox.Cli keygen --count 1 > /srv/lockbox/secrets/master.txt
/opt/lockbox/LockBox.Cli keygen --count 1 > /srv/lockbox/secrets/layer1.txtActivation and license status
The license key is bound to the device ID printed by the same CLI build. If a license is copied to another PC, LockBox rejects it and falls back to Free.
Windows checks the existing LockBox application data locations. Linux stores activation in
$XDG_CONFIG_HOME/lockbox/.lockbox.license, then
~/.config/lockbox/.lockbox.license, with ~/.lockbox/.lockbox.license
as a fallback.
Get device ID
.\LockBox.Cli.exe device-id
Check current edition
.\LockBox.Cli.exe license
Activate from a license file
.\LockBox.Cli.exe activate --license-file "C:\Licenses\lockbox-license.txt"
Activate from an environment variable
$env:LBX_LICENSE = "LBX-LIC-..."
.\LockBox.Cli.exe activate --license-env LBX_LICENSE
Activate inline
Inline activation works, but it can leak through shell history or process logs.
.\LockBox.Cli.exe activate --license "LBX-LIC-..."
Linux activation
export LBX_LICENSE="LBX-LIC-..."
./LockBox.Cli activate --license-env LBX_LICENSE
./LockBox.Cli licenseSecret handling
Prefer environment variables or files. Inline secrets are useful for testing only. Master passwords and layer keys must be preserved: without them the container cannot be opened.
| Purpose | Inline | Environment | File |
|---|---|---|---|
| Master password | --master value |
--master-env ENV |
--master-file path |
| Create layer key | --layer ALG=KEY |
--layer-env ALG=ENV |
--layer-file ALG=FILE |
| Open layer key | --key value |
--key-env ENV |
--key-file path |
| Scheduler file password | --password value |
--password-env ENV |
--password-file path |
| Container destruction password | --destruction-password value |
--destruction-password-env ENV |
--destruction-password-file path |
| License key | --license value |
--license-env ENV |
--license-file path |
File-based secrets
Set-Content -Path ".\master.txt" -Value "master-password" -Encoding UTF8
Set-Content -Path ".\layer1.txt" -Value "layer-key-1" -Encoding UTF8
.\LockBox.Cli.exe create `
-s "D:\Data" `
-o "E:\Backups\data.lbx" `
--master-file ".\master.txt" `
--layer-file AES-128-GCM=.\layer1.txtAlgorithms and key generation
Use algorithms to see all supported profiles and minimum editions.
Use keygen for layer keys.
.\LockBox.Cli.exe algorithms
.\LockBox.Cli.exe keygen
.\LockBox.Cli.exe keygen --count 9
.\LockBox.Cli.exe generate-keys -n 20
Supported command aliases:
algorithms
list-algorithms
profiles
keygen
generate-key
generate-keysCreate containers
create packs a source folder, applies optional compression and padding,
encrypts the payload through one or more layers, and writes a .lbx container.
Required options
--sourceor-s: source folder.--outputor-o: output.lbxpath.--master,--master-env, or--master-file.- At least one layer:
--layer,--layer-env, or--layer-file.
Minimal AES container
.\LockBox.Cli.exe create `
-s "D:\Data" `
-o "E:\Backups\data.lbx" `
--master-env LBX_MASTER `
--layer-env AES-128-GCM=LBX_L1
Compressed container
.\LockBox.Cli.exe create `
--source "D:\Exports" `
--output "E:\Backups\exports.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--compress
Crypto padding
.\LockBox.Cli.exe create `
-s "D:\Contracts" `
-o "E:\Backups\contracts.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--padding 2GB
Split container into parts
.\LockBox.Cli.exe create `
-s "D:\Media" `
-o "E:\Backups\media.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--split 700MB
The first part keeps .lbx. Additional parts use
.lbx1, .lbx2, and so on. Keep all parts in the same folder.
Nine-layer Max example
$env:LBX_MASTER = "use-a-long-master-password"
$env:LBX_L1 = "layer-1-key"
$env:LBX_L2 = "layer-2-key"
$env:LBX_L3 = "layer-3-key"
$env:LBX_L4 = "layer-4-key"
$env:LBX_L5 = "layer-5-key"
$env:LBX_L6 = "layer-6-key"
$env:LBX_L7 = "layer-7-key"
$env:LBX_L8 = "layer-8-key"
$env:LBX_L9 = "layer-9-key"
.\LockBox.Cli.exe create `
--source "D:\Data" `
--output "E:\Backups\data-max.lbx" `
--master-env LBX_MASTER `
--compress `
--padding 2GB `
--split 700MB `
--layer-env AES-256-GCM=LBX_L1 `
--layer-env CHACHA20-POLY1305=LBX_L2 `
--layer-env AES-256-CCM=LBX_L3 `
--layer-env SERPENT-256-CTR-HMACSHA512=LBX_L4 `
--layer-env TWOFISH-256-CTR-HMACSHA512=LBX_L5 `
--layer-env CAMELLIA-256-CTR-HMACSHA512=LBX_L6 `
--layer-env ARIA-256-CTR-HMACSHA512=LBX_L7 `
--layer-env AES-256-CBC-HMACSHA512=LBX_L8 `
--layer-env AES-192-OFB-HMACSHA384=LBX_L9
Alternative algorithm/key syntax
.\LockBox.Cli.exe create `
-s "D:\Data" `
-o "E:\Backups\data.lbx" `
--master-env LBX_MASTER `
--algorithm AES-128-GCM --key-env LBX_L1 `
--algorithm AES-128-CTR-HMACSHA256 --key-env LBX_L2
Delete source after successful manual creation
.\LockBox.Cli.exe create `
-s "D:\TempToEncrypt" `
-o "E:\Backups\temp.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--delete-source
--delete-source deletes the source folder only after the container is created successfully.
Scheduler has a different option: --delete-source-contents.
Container destruction password
Max edition can add a separate destruction password to a container. If that password is entered later as the master password, LockBox immediately overwrites the container without confirmation. This is intended for coercion-pressure scenarios. Keep it separate from the real master password.
The command verifies free disk space, encrypts the original container data with a fresh random
secret and AES-256-GCM into a temporary file, normalizes the result to the exact original size,
replaces the original file, and forgets the random secret. For split containers, every
.lbx, .lbx1, .lbx2 part in the same folder is replaced
while preserving the original part sizes.
Create with a destruction password
$env:LBX_MASTER = "real-master-password"
$env:LBX_L1 = "layer-key-1"
$env:LBX_DESTROY = "pressure-password"
.\LockBox.Cli.exe create `
--source "D:\Data" `
--output "E:\Backups\data.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--destruction-password-env LBX_DESTROY
Trigger destruction without layer keys
.\LockBox.Cli.exe open `
--container "E:\Backups\data.lbx" `
--output "D:\Restore" `
--master-env LBX_DESTROY
Linux trigger
export LBX_DESTROY="pressure-password"
./LockBox.Cli open \
--container "/backup/data.lbx" \
--output "/restore" \
--master-env LBX_DESTROY
After successful destruction the container is no longer a valid LockBox file. The CLI returns
exit code 0 because the requested destruction action completed successfully.
Open containers
open extracts a container to the output folder. For normal extraction, layer keys must
be passed in the same order used during creation. For a destruction-password workflow, only the
container path, output path, and destruction password as the master password are required.
Open a one-layer container
.\LockBox.Cli.exe open `
--container "E:\Backups\data.lbx" `
--output "D:\Restore" `
--master-env LBX_MASTER `
--key-env LBX_L1
Open a split container
.\LockBox.Cli.exe open `
-c "E:\Backups\data.lbx" `
-o "D:\Restore" `
--master-env LBX_MASTER `
--key-env LBX_L1
Open a multi-layer container
.\LockBox.Cli.exe open `
-c "E:\Backups\data-max.lbx" `
-o "D:\Restore" `
--master-env LBX_MASTER `
--key-env LBX_L1 `
--key-env LBX_L2 `
--key-env LBX_L3 `
--key-env LBX_L4 `
--key-env LBX_L5 `
--key-env LBX_L6 `
--key-env LBX_L7 `
--key-env LBX_L8 `
--key-env LBX_L9
Aliases
open
decrypt
extractVerify a backup by restoring it
Create a small source file named report.csv for this example. Restore into a new folder: the original source folder name is preserved inside it. Keep all split parts together. Compare restored files with the unchanged source. Extraction needs writable space beside the container for temporary data; protect the restored plaintext as well.
$ErrorActionPreference = 'Stop'
$cli = 'C:\Tools\LockBox\LockBox.Cli.exe'
$container = 'E:\Backups\data.lbx'
$restore = Join-Path 'D:\RestoreChecks' ([guid]::NewGuid().ToString('N'))
& $cli open --container $container --output $restore --master-file 'C:\LockBox\secrets\master.txt' --key-file 'C:\LockBox\secrets\layer1.txt'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$original = (Get-FileHash -LiteralPath 'D:\Data\report.csv' -Algorithm SHA256).Hash
$restored = (Get-FileHash -LiteralPath (Join-Path $restore 'Data\report.csv') -Algorithm SHA256).Hash
if ($original -ne $restored) { throw 'SHA256 mismatch' }
Write-Output $restoreset -eu
umask 077
mkdir -p /restore
restore=$(mktemp -d /restore/check-XXXXXX)
/opt/lockbox/LockBox.Cli open --container /backup/data.lbx --output "$restore" --master-file /srv/lockbox/secrets/master.txt --key-file /srv/lockbox/secrets/layer1.txt
cmp /srv/data/report.csv "$restore/data/report.csv"
sha256sum /srv/data/report.csv "$restore/data/report.csv"Scheduler
Scheduler commands are available in Max edition. They store full task metadata
in an encrypted .lbxjobs file, including source path, output path,
passwords, destruction password, layer keys, compression, padding, splitting, and
delete-source-contents setting.
Scheduled jobs run only while LockBox.Cli.exe schedule run is running.
Use Windows Task Scheduler, Linux systemd, cron, a service wrapper, or a long-running console
session if you need the worker to start automatically after reboot.
Frequency values
once
30m
hourly
2h
3h
6h
9h
12h
18h
daily
2d
3d
5d
weekly
2w
monthly
2mo
3mo
6mo
9mo
yearly
Add a daily encrypted backup task
$env:LBX_JOBS_PASSWORD = "jobs-file-password"
$env:LBX_MASTER = "master-password"
$env:LBX_L1 = "layer-key-1"
$env:LBX_DESTROY = "pressure-password"
.\LockBox.Cli.exe schedule add `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD `
--name "Nightly data backup" `
--frequency daily `
--start ((Get-Date).AddDays(1).ToString("o")) `
--source "D:\Data" `
--output "E:\Backups\nightly-data.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--destruction-password-env LBX_DESTROY `
--compress
Add a task that deletes source folder contents after success
.\LockBox.Cli.exe schedule add `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD `
--name "Encrypt outgoing folder" `
--frequency 30m `
--start ((Get-Date).AddDays(1).ToString("o")) `
--source "D:\Outgoing" `
--output "E:\Backups\outgoing.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--delete-source-contents
Add a monthly archive with padding and split parts
.\LockBox.Cli.exe schedule add `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD `
--name "Monthly legal archive" `
--frequency monthly `
--start ((Get-Date).AddDays(1).ToString("o")) `
--source "D:\Legal" `
--output "E:\Archives\legal-monthly.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--compress `
--padding 4GB `
--split 2GB
List saved tasks
.\LockBox.Cli.exe schedule list `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD
Run the scheduler worker
.\LockBox.Cli.exe schedule run `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD `
--state "E:\Backups\jobs.status.json" `
--poll-seconds 30
Run due tasks once and exit
.\LockBox.Cli.exe schedule run-once `
--tasks "E:\Backups\jobs.lbxjobs" `
--password-env LBX_JOBS_PASSWORD `
--state "E:\Backups\jobs.status.json"
Show latest runtime status
.\LockBox.Cli.exe schedule status --state "E:\Backups\jobs.status.json"
Status markers are [OK], [RUNNING], and [FAILED].
A failed task includes the reason and tells the user to contact support if the problem repeats.
JSON scripts
Use --script when a workflow has several steps. The script runner supports
create, open, keygen, algorithms,
device-id, license, and activate.
Create and open in one script
{
"stopOnError": true,
"commands": [
{
"command": "create",
"source": "D:\\Data",
"output": "E:\\Backups\\data.lbx",
"masterPasswordEnv": "LBX_MASTER",
"destructionPasswordEnv": "LBX_DESTROY",
"compression": true,
"padding": "512MB",
"split": "700MB",
"layers": [
{ "algorithm": "AES-256-GCM", "keyEnv": "LBX_L1" },
{ "algorithm": "CHACHA20-POLY1305", "keyEnv": "LBX_L2" }
]
},
{
"command": "open",
"container": "E:\\Backups\\data.lbx",
"output": "D:\\Restore",
"masterPasswordEnv": "LBX_MASTER",
"keyEnvs": [ "LBX_L1", "LBX_L2" ]
}
]
}
.\LockBox.Cli.exe --script ".\backup.lockbox.json"
Continue after a failed step
{
"stopOnError": false,
"commands": [
{ "command": "license" },
{ "command": "algorithms" },
{
"command": "create",
"source": "D:\\BuildOutput",
"output": "E:\\Artifacts\\build.lbx",
"masterPasswordEnv": "LBX_MASTER",
"layers": [
{ "algorithm": "AES-128-GCM", "keyEnv": "LBX_L1" }
]
}
]
}
Activate from script
{
"commands": [
{
"command": "activate",
"licenseKeyFile": "C:\\Licenses\\lockbox-license.txt"
},
{ "command": "license" }
]
}JSON fields and execution rules
The table maps create fields and open key arrays to CLI options. Paths are relative to the process working directory, not the JSON file. Variables and timestamps inside strings are not expanded. Use one secret source per field; open keys are collected as keys, then keyEnvs, then keyFiles. Prefer stopOnError: true: with false, a later successful step can mask an earlier failure. Scheduler commands are not supported inside JSON scripts.
{
"stopOnError": true,
"commands": [
{
"command": "create",
"source": "/srv/data",
"output": "/backup/data.lbx",
"masterPasswordFile": "/srv/lockbox/secrets/master.txt",
"layers": [
{ "algorithm": "AES-128-GCM", "keyFile": "/srv/lockbox/secrets/layer1.txt" }
]
},
{
"command": "open",
"container": "/backup/data.lbx",
"output": "/restore/check",
"masterPasswordFile": "/srv/lockbox/secrets/master.txt",
"keyFiles": ["/srv/lockbox/secrets/layer1.txt"]
}
]
}/opt/lockbox/LockBox.Cli --quiet script /srv/lockbox/backup.lockbox.jsonsource / sourceFolder / sourceFolderPath | --source | Folder to pack and encrypt. |
output / outputContainerPath | --output | Output .lbx path. |
masterPassword | --master | Inline master password. |
masterPasswordEnv | --master-env | Read master password from environment variable. |
masterPasswordFile | --master-file | Read master password from UTF-8 text file. |
layers[].algorithm + layers[].key | --layer | Add ALGORITHM=KEY. |
layers[].algorithm + layers[].keyEnv | --layer-env | Add ALGORITHM=ENV. |
layers[].algorithm + layers[].keyFile | --layer-file | Add ALGORITHM=FILE. |
compression / compress | --compress | Enable compression. |
padding | --padding | Add encrypted random padding. Units: B, KB, MB, GB, TB. |
paddingBytes | --padding-bytes | Padding size in raw bytes. |
split / splitSize | --split | Split output into .lbx, .lbx1, .lbx2. |
splitPartSizeBytes | --split-bytes | Split part size in raw bytes. |
destructionPassword | --destruction-password | Max-only inline destruction password. Entering it later as the master password overwrites the container immediately. |
destructionPasswordEnv | --destruction-password-env | Read the Max-only destruction password from an environment variable. |
destructionPasswordFile | --destruction-password-file | Read the Max-only destruction password from a UTF-8 text file. |
deleteSource / deleteSourceFolderAfterSuccess | --delete-source | Delete source folder after successful manual creation. |
container / containerPath | --container | Existing .lbx container. |
keys[] | --key | Inline layer key in original order. |
keyEnvs[] | --key-env | Layer key from environment variable. |
keyFiles[] | --key-file | Layer key from UTF-8 text file. |
Automation recipes
Encrypted database dump backup
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$dump = "D:\DbDumps\$stamp"
New-Item -ItemType Directory -Path $dump | Out-Null
Copy-Item "D:\DatabaseExports\*" $dump -Recurse
.\LockBox.Cli.exe create `
-s $dump `
-o "E:\Backups\db-$stamp.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--compress `
--padding 512MB
CI artifact protection
.\LockBox.Cli.exe create `
--source "$env:BUILD_ARTIFACTSTAGINGDIRECTORY" `
--output "$env:AGENT_TEMPDIRECTORY\protected-artifacts.lbx" `
--master-env LBX_MASTER `
--layer-env AES-128-GCM=LBX_L1
Secure partner transfer
.\LockBox.Cli.exe create `
-s "D:\PartnerPackage" `
-o "E:\Transfer\partner-package.lbx" `
--master-env LBX_MASTER `
--layer-env AES-256-GCM=LBX_L1 `
--layer-env CHACHA20-POLY1305=LBX_L2 `
--compress `
--split 1GB
Long-term archive
.\LockBox.Cli.exe create `
-s "D:\Records\2026" `
-o "E:\ColdStorage\records-2026.lbx" `
--master-file "C:\Secrets\records-master.txt" `
--layer-file AES-256-GCM=C:\Secrets\records-layer1.txt `
--layer-file SERPENT-256-CTR-HMACSHA512=C:\Secrets\records-layer2.txt `
--compress `
--padding 8GB `
--split 4GB
Batch file example
@echo off
set LBX_MASTER=master-password
set LBX_L1=layer-key-1
LockBox.Cli.exe create ^
--source "D:\Data" ^
--output "E:\Backups\data.lbx" ^
--master-env LBX_MASTER ^
--layer-env AES-128-GCM=LBX_L1
if errorlevel 1 exit /b %errorlevel%
echo OKWindows: back up several folders
Save the script at the path shown. It creates a separate, uniquely named container and log for each source, stops on failure and preserves the CLI exit code. This AES-128-GCM recipe works in Free; compression and splitting require Pro or Max.
C:\LockBox\backup.ps1
param(
[string[]]$Source = @('D:\Data'),
[string]$Destination = 'E:\Backups'
)
$ErrorActionPreference = 'Stop'
$cli = 'C:\Tools\LockBox\LockBox.Cli.exe'
$secretDir = 'C:\LockBox\secrets'
try {
foreach ($folder in $Source) {
$sourcePath = (Resolve-Path -LiteralPath $folder).Path
$stamp = (Get-Date).ToUniversalTime().ToString('yyyyMMdd-HHmmss-fff')
$runId = [guid]::NewGuid().ToString('N')
$runDir = Join-Path $Destination "$stamp-$runId"
New-Item -ItemType Directory -Path $runDir | Out-Null
$container = Join-Path $runDir 'data.lbx'
$log = Join-Path $runDir 'create.log'
$cliArgs = @(
'--quiet', 'create', '--source', $sourcePath, '--output', $container,
'--master-file', (Join-Path $secretDir 'master.txt'),
'--layer-file', ('AES-128-GCM=' + (Join-Path $secretDir 'layer1.txt'))
)
$ErrorActionPreference = 'Continue'
& $cli @cliArgs > $log 2>&1
$result = $LASTEXITCODE
$ErrorActionPreference = 'Stop'
if ($result -ne 0) {
Get-Content -LiteralPath $log
exit $result
}
if (-not (Test-Path -LiteralPath $container -PathType Leaf)) {
throw "Container missing: $container"
}
Write-Output $container
}
exit 0
} catch {
Write-Error $_ -ErrorAction Continue
exit 1
}& 'C:\LockBox\backup.ps1' -Source 'D:\Data', 'D:\Reports' -Destination 'E:\Backups'
# 0 = success; 1 = runtime error; 2 = usage error; 3 = edition restriction
$LASTEXITCODELinux: unattended backups
Save the Bash script with LF line endings. Install the CLI and prepare the secret files at the paths shown. Pass source folders as arguments. Each run gets a unique directory; failures leave a log and return a nonzero code. Source files remain in place.
/srv/lockbox/backup.sh
#!/bin/bash
set -eu
umask 077
cli=/opt/lockbox/LockBox.Cli
secret_dir=/srv/lockbox/secrets
backup_root=/backup
mkdir -p "$backup_root"
if [ "$#" -eq 0 ]; then
set -- /srv/data
fi
for source in "$@"; do
run_dir=$(mktemp -d "$backup_root/$(date -u +%Y%m%d-%H%M%S)-XXXXXX")
container="$run_dir/data.lbx"
log="$run_dir/create.log"
"$cli" --quiet create \
--source "$source" \
--output "$container" \
--master-file "$secret_dir/master.txt" \
--layer-file "AES-128-GCM=$secret_dir/layer1.txt" > "$log" 2>&1 || {
result=$?
cat "$log" >&2
exit "$result"
}
test -s "$container"
printf '%s\n' "$container"
done/bin/bash /srv/lockbox/backup.sh /srv/data /srv/reportsRun backups on an OS schedule
These tasks launch the backup scripts above; Max is not required for this use of create. Windows registration below runs only while the selected user is logged in; configure execution while logged out in Task Scheduler if needed. Add the cron entry to the backup user's crontab after checking flock is installed. Both examples run at 02:00 local time and prevent overlapping scheduled instances. Check account permissions and test manually first.
Windows
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -NonInteractive -File "C:\LockBox\backup.ps1"' -WorkingDirectory 'C:\LockBox'
$trigger = New-ScheduledTaskTrigger -Daily -At '02:00'
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew -ExecutionTimeLimit ([TimeSpan]::Zero)
$principal = New-ScheduledTaskPrincipal -UserId ([Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive
Register-ScheduledTask -TaskName 'LockBox backup' -Action $action -Trigger $trigger -Settings $settings -Principal $principal
Start-ScheduledTask -TaskName 'LockBox backup'
Get-ScheduledTaskInfo -TaskName 'LockBox backup'New-ScheduledTaskSettingsSet · New-ScheduledTaskPrincipal
Linux: cron
crontab -e0 2 * * * /usr/bin/flock -n /srv/lockbox/backup.lock /bin/bash /srv/lockbox/backup.sh >> /srv/lockbox/cron.log 2>&1Max: operate a scheduler worker
First create the lockbox service account, grant access to the listed paths, activate Max for that account and prepare a separate UTF-8 jobs.txt password file. Add each task once: add appends, it does not update. Keep one worker per task file and restart it after changing definitions. The status JSON is telemetry, not a resume checkpoint: restarting skips overdue recurring occurrences, while an overdue once task can run again. For periodic OS launches use create, not repeated run-once. The built-in scheduler reuses its configured output name.
/opt/lockbox/LockBox.Cli schedule add \
--tasks /srv/lockbox/jobs.lbxjobs \
--password-file /srv/lockbox/secrets/jobs.txt \
--name nightly-data --frequency daily \
--start "$(date -d 'tomorrow 02:00' --iso-8601=seconds)" \
--source /srv/data --output /backup/nightly-data.lbx \
--master-file /srv/lockbox/secrets/master.txt \
--layer-file AES-128-GCM=/srv/lockbox/secrets/layer1.txt
/opt/lockbox/LockBox.Cli schedule list --tasks /srv/lockbox/jobs.lbxjobs --password-file /srv/lockbox/secrets/jobs.txt/etc/systemd/system/lockbox-scheduler.service
[Unit]
Description=LockBox scheduler
After=local-fs.target
RequiresMountsFor=/srv/data /srv/lockbox /backup
[Service]
Type=simple
User=lockbox
WorkingDirectory=/srv/lockbox
UMask=0077
ExecStart=/opt/lockbox/LockBox.Cli schedule run --tasks /srv/lockbox/jobs.lbxjobs --password-file /srv/lockbox/secrets/jobs.txt --state /srv/lockbox/jobs.status.json --poll-seconds 30
Restart=on-failure
RestartSec=10
KillSignal=SIGINT
TimeoutStopSec=300
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now lockbox-scheduler.service
systemctl status lockbox-scheduler.service
journalctl -u lockbox-scheduler.service -n 50 --no-pager
/opt/lockbox/LockBox.Cli schedule status --state /srv/lockbox/jobs.status.jsonCommand reference
| Command | Purpose | Aliases |
|---|---|---|
help | Show console help. | --help, -h, ? |
device-id | Print PC device ID for license issue. | deviceid, machine-id |
license | Show current edition and license path. | license-status, status |
activate | Install a device-bound license key. | activation |
algorithms | List algorithms and minimum editions. | profiles, list-algorithms |
keygen | Generate random keys. | generate-key, generate-keys |
create | Create encrypted container. | encrypt |
open | Extract encrypted container. | decrypt, extract |
schedule | Manage and run scheduled tasks. | scheduler, scheduled-tasks |
script | Run JSON automation file. | --script |
Create options
--source, -s | Folder to pack and encrypt. |
--output, -o | Output .lbx path. |
--master | Inline master password. |
--master-env | Read master password from environment variable. |
--master-file | Read master password from UTF-8 text file. |
--layer | Add ALGORITHM=KEY. |
--layer-env | Add ALGORITHM=ENV. |
--layer-file | Add ALGORITHM=FILE. |
--algorithm, -a | Alternative algorithm form paired with --key, --key-env, or --key-file. |
--compress | Enable compression. |
--no-compress | Disable compression if set earlier. |
--padding | Add encrypted random padding. Units: B, KB, MB, GB, TB. |
--padding-bytes | Padding size in raw bytes. |
--split | Split output into .lbx, .lbx1, .lbx2. |
--split-bytes | Split part size in raw bytes. |
--no-split | Disable splitting if set earlier. |
--destruction-password | Max-only inline destruction password. Entering it later as the master password overwrites the container immediately. |
--destruction-password-env | Read the Max-only destruction password from an environment variable. |
--destruction-password-file | Read the Max-only destruction password from a UTF-8 text file. |
--delete-source | Delete source folder after successful manual creation. |
Open options
--container, -c | Existing .lbx container. |
--output, -o | Extraction folder. |
--master, --master-env, --master-file | Master password source. |
--key, -k | Inline layer key in original order. |
--key-env | Layer key from environment variable. |
--key-file | Layer key from UTF-8 text file. |
— | Allowed for destruction-password workflows. Normal extraction fails after metadata reading if required keys are missing. |
Scheduler options
schedule add | Add a task to encrypted .lbxjobs. |
schedule list | Show saved tasks. |
schedule run | Run long-lived worker. |
schedule run-once | Run due tasks once and exit. |
schedule status | Read latest runtime status JSON. |
--tasks, --file | Encrypted task file path. |
--password, --password-env, --password-file | Password for task file. |
--state, --status-file | Runtime status JSON path. |
--name | Task name for schedule add. |
--frequency, --every | Task frequency. |
--start, --start-at | Local start date/time. |
--delete-source-contents | Delete original source folder contents after successful scheduled run. |
--poll-seconds | Worker polling interval for schedule run. |
Use --language or --lang to select the console language and --quiet to suppress routine progress; errors still go to standard error. Ctrl+C requests cancellation and returns code 1. Code 2 means invalid command syntax; code 3 means a creation feature is unavailable in the current edition. Code 0 also covers an intentionally triggered destruction password, so it does not by itself prove that files were extracted. Verify the expected output before subsequent automation steps.
Exit codes and backup monitoring
A zero exit code from schedule run-once does not guarantee task success; schedule status also returns zero for missing status. Check savedAt, lastSuccessAt and lastError. An [OK] marker can mean merely Ready. This monitor expects daily backups, a live worker polling every 30 seconds and a success within 26 hours; adjust thresholds for your schedule. The JSON stores numeric states. With --quiet, successful create/open commands produce no routine output.
$ErrorActionPreference = 'Stop'
try {
$status = Get-Content -LiteralPath 'E:\Backups\jobs.status.json' -Raw | ConvertFrom-Json
if (@($status.tasks).Count -eq 0) { throw 'No tasks in status file' }
if ([DateTimeOffset]$status.savedAt -lt [DateTimeOffset]::Now.AddMinutes(-2)) {
throw 'Worker status is stale'
}
foreach ($task in $status.tasks) {
if ($task.state -eq 3 -or $task.lastError) { throw "Task failed: $($task.name)" }
if (-not $task.lastSuccessAt -or [DateTimeOffset]$task.lastSuccessAt -lt [DateTimeOffset]::Now.AddHours(-26)) {
throw "No recent successful backup: $($task.name)"
}
}
exit 0
} catch {
Write-Error $_ -ErrorAction Continue
exit 1
}0 -> Ready
1 -> Running
2 -> Completed
3 -> FailedTroubleshooting
Why do I get exit code 3?
The current edition does not allow the requested feature: too many layers, compression, crypto padding, splitting, scheduler, or a stronger algorithm.
Why does extraction fail with an authentication tag error?
The master password, layer key, layer order, or container file is wrong. For split containers, also verify that every part is present in the same folder.
Why does the scheduler not run after I close the console?
schedule run is the worker process. Keep it open, or launch it from Windows Task Scheduler or a service wrapper.
Why does schedule add fail immediately?
The scheduler validates license, source folder, output path, algorithms, passwords, and available disk space before saving the task.
Can I store scheduler passwords inside the .lbxjobs file?
Yes. The .lbxjobs file is encrypted with the scheduler file password and stores full task metadata, including encryption passwords and layer keys.
What happens if a scheduled run overlaps the previous run?
The new event is skipped, the task reports a failed status with an explanation, and future runs continue after the active run finishes.
How do I avoid secrets in shell history?
Use --master-env, --master-file, --layer-env, --layer-file, --destruction-password-env, --destruction-password-file, --password-env, and --password-file.