Vault Lock & Backup

unlisted

by obsidian-lock

Passphrase lock screen, a private folder hidden while locked, and a one-way backup of the vault to a WebDAV server.

Updated 20d agoMIT
View on GitHub

Vault Lock & Backup

Latest release CI License: MIT Obsidian 1.5+ desktop

An Obsidian plugin for one person, one computer, and a server you control:

  • Nothing to set up. Install with BRAT and choose a passphrase. The plugin pairs itself with your server: no server address or password to type, and none published anywhere.
  • Lock screen. A passphrase overlay at launch, after a few idle minutes, or on demand.
  • Private folder. One folder disappears from Obsidian whenever the vault is locked.
  • One-way backup. Every file in the vault is copied to your own WebDAV server as plain files. Nothing on the server is ever deleted. The backup shows nothing in Obsidian: no status, no notices, no commands.
  • Server-side control. The server changes settings, sends commands, and reads the plugin's health through a few JSON files next to the backup. Nothing connects in to your computer.

[!IMPORTANT] This is a privacy screen, not a safe. Nothing is encrypted. Anyone with access to the vault's files can read them, private folder included. Use full-disk encryption (BitLocker, FileVault, LUKS) to protect a lost or stolen laptop. See Security model.

Contents

Design principles

  • Never lose data. The server never deletes anything. Files you delete or rename away are moved into _trash/<timestamp>/. A restore parks the local copy in _trash/ before overwriting it.
  • One mechanism. Backup reliability comes from a single reconcile that compares every local file with an index on the server and uploads whatever differs. Live file events only make it happen sooner, so a missed event can never cause a missed file.
  • Plain files. The backup is your vault as ordinary files. No database and no proprietary format, so you can read or restore it with any tool.
  • Failures are visible on the server. After every backup, and when one fails, the plugin reports to _control/status.json, which vlb status shows; it retries on its own. The computer shows nothing about the backup, so there is nothing to misread or to switch off by accident.

Install

The plugin is not in the Obsidian community catalogue; BRAT installs it from this repository and keeps it up to date.

  1. Settings → Community plugins → Browse, install BRAT and enable it.
  2. Open this link in your browser. Obsidian will ask BRAT to add the plugin:
    obsidian://brat?plugin=obsidian-lock/vault-lock-backup
    
    Or go to BRAT settings → Add beta plugin and enter obsidian-lock/vault-lock-backup.
  3. Enable Vault Lock & Backup under Settings → Community plugins.

That's all. There are no server details to enter: see Pairing.

Windows, one command instead: close Obsidian, open PowerShell and paste irm https://raw.githubusercontent.com/obsidian-lock/vault-lock-backup/main/install.ps1 | iex. install.ps1 installs this plugin and BRAT into the vault Obsidian knows (it asks if there are several), turns both on, and opens Obsidian. Running it again is safe.

Manual install: download main.js, manifest.json and styles.css from the latest release into <vault>/.obsidian/plugins/vault-lock-backup/, then enable the plugin.

Desktop only (Windows, macOS, Linux). Obsidian 1.5.0 or newer.

Set up

The first time Obsidian starts with the plugin, it asks for a passphrase. That is the only step. If you close the prompt, it comes back at the next start.

  • If Obsidian says community plugins are turned off: Settings → Community plugins → Turn on community plugins.
  • The backup starts by itself and shows nothing in Obsidian. On the server, vlb status lists the computer within a minute, with its last check-in.
  • To change the passphrase: Settings → Vault Lock & Backup → Change passphrase, or the Set or change passphrase command. It asks for the current one first.
  • Put notes that should disappear while locked in a top-level folder named Private.

The plugin's settings are only about the passphrase and the lock. The backup has no settings, status or commands in Obsidian: it pairs itself with the server, runs by itself, and is watched and driven from the server.

SettingDefault
Passphraseset on first start; Change passphrase asks for the current one first
Lock after idle (minutes)5 (0 turns it off)
Lock when the window loses focusoff
Private folderPrivate; change it only while unlocked

The server can change the lock options and the backup options; see Controlling the plugin from the server.

Commands

Open the command palette (Ctrl/Cmd+P):

CommandWhat it does
Lock vault nowLocks immediately. Needs a passphrase.
Set or change passphraseOpens the passphrase prompt.

The backup has no commands in Obsidian. A re-upload of everything or a restore from the server is sent from the server (reset-index, restore-all); see Controlling the plugin from the server.

How the backup works

The reconcile lists every local file (modification time and size) and compares it with _manifest.json on the server. It uploads whatever is new or changed. Anything in the index that no longer exists locally is moved to _trash/. It runs:

  • 8 seconds after Obsidian starts,
  • every N minutes (default 10),
  • when the computer comes back online,
  • one minute after any failure, until it succeeds.

Edits, renames and deletes are also sent within a couple of seconds as they happen. The reconcile is the safety net that catches anything those miss.

What this computer's folder on the server looks like (each paired computer has its own, data/devices/<computer>-<id>/, and sees only that):

<computer's folder>/
├── Notes/…, Private/…           your vault as plain files, including .obsidian/
├── _manifest.json               index: path → modification time + size
├── _trash/<timestamp>/…         deleted, renamed-away, or overwritten files
└── _control/
    ├── config.json              you write: settings overrides
    ├── commands.json            you write: one-shot commands
    └── status.json              the plugin writes: health, last run, command results

Details:

  • The private folder is always stored as Private/ on the server, even while it is hidden locally as .Private/.
  • Always skipped: the plugin's own data.json (it holds your passphrase hash and this computer's server key), files over 100 MB (listed in status.json), and top-level _manifest.json, _trash/, _control/ and _pair/ in the vault, because those names are reserved on the server.
  • Health: after every reconcile, and when something fails, the plugin writes _control/status.json (last run, last error, skipped files). vlb status on the server shows it. In Obsidian nothing is shown; the developer console (Ctrl+Shift+I) logs every step as [VLB backup] and [VLB pairing].
  • Nothing uploads while Obsidian is closed. The reconcile at the next start catches up.

Pairing

A computer gets its own login on the server without anyone typing a password:

  1. On first start the plugin makes up a login and a random key and saves them in its data.json.
  2. It drops a small request into the server's pairing inbox: an id, the computer's name, and a bcrypt hash of the key. The key itself never leaves the computer.
  3. Within 15 seconds the server accepts the request: the computer gets its own login and its own folder. Every computer that asks is accepted, so yours can never be blocked by someone else pairing first.
  4. The plugin notices its login works and starts backing up.

Every computer sees only its own folder. If a stranger installs the plugin, they get an empty sandbox of their own, never your notes. Strangers are kept cheap: a computer you haven't marked with vlb mine is frozen (it can read but not write) when its folder grows past 10 GB, when all strangers together pass 30 GB, or when the disk has less than 10 GB free. Once you have marked your computer, the strangers' folders are also left out of the nightly snapshot.

The inbox's login is built into the plugin and is public on purpose. It can only create files of up to 4 KB in the inbox, a separate container that can't reach the backups.

On the server, vlb manages it:

CommandWhat it does
vlb statusPairing state and every paired computer: yours or stranger, folder, size, frozen or not, last check-in.
vlb mine COMPUTERThis computer is yours: never frozen, always in the snapshot. Run it once vlb status lists your computer (check its name and user).
vlb move COMPUTER FOLDERThat computer continues an existing folder: a new or reinstalled laptop picks up where the old one left off (then send it restore-all, see below). Its login is reset; it pairs again within a minute.
vlb remove COMPUTERRevoke a computer's login and refuse that computer from now on. Its folder is kept. vlb move lets it back in.
vlb close / vlb openPause and resume accepting computers. Paused computers keep asking every minute. vlb open --only NAME accepts just the computer with that name (for a flood).

COMPUTER is the computer's name (if unique), login, id or folder as vlb status shows it. A computer whose login stops working (for example after vlb move) asks to pair again every minute, so it reconnects by itself. At most 100 computers can be paired; beyond that new ones are refused until you remove some.

Server setup

The server/ folder is a tested setup: hacdias/webdav in Docker (one container for the backups, one for the pairing inbox) behind Caddy, which provides HTTPS automatically, plus vlb.

mkdir -p /opt/obsidian-webdav && cd /opt/obsidian-webdav
# from server/: docker-compose.yml here (set the Docker network your reverse proxy is on),
# vlb into /usr/local/bin, the two systemd units into /etc/systemd/system
install -m 755 vlb /usr/local/bin/vlb
vlb apply --no-restart                 # writes conf/webdav/ and conf/pair/ from state.json
docker compose up -d
systemctl daemon-reload && systemctl enable --now vlb-pair.timer   # handles the inbox every 15 s
vlb status                             # pairing is open from the start
  1. Point a DNS name (for example vault.example.com) at the server, and put it in SERVER_URL in src/server.ts if you build your own copy.
  2. Add server/Caddyfile.snippet to your Caddyfile and reload Caddy. It sends /_pair/ to the inbox (4 KB limit) and everything else to the backups. If you use another reverse proxy, don't rewrite the Host header: WebDAV MOVE compares it with the destination URL.
  3. Install the plugin on a computer; vlb status shows it within a minute.

Never edit conf/ by hand: vlb regenerates it from state.json. Backups land in /opt/obsidian-webdav/data/devices/. Take a nightly snapshot of data/, conf/ and state.json to somewhere off the server, for example with restic or tar czf /backups/vault-$(date +%F).tgz --exclude-from=snapshot-exclude.txt data conf state.json (snapshot-exclude.txt is written by vlb: the strangers' folders, once you have run vlb mine).

Controlling the plugin from the server

Everything happens in _control/ inside the computer's folder (on the server: data/devices/<folder>/_control/). The plugin reads it at the start of every reconcile (at startup and every 10 minutes by default) and writes status.json afterwards, and again when a backup fails. This is the only place the backup is seen or steered: the plugin has no backup status or commands in Obsidian.

config.json: any subset of these. The server's value wins and is saved on the computer.

{ "idleMinutes": 5, "lockOnBlur": false, "reconcileMinutes": 10,
  "excludes": [".trash/", ".obsidian/workspace"] }

reconcileMinutes is how often the whole vault is compared with the server (besides live uploads). excludes lists path prefixes that are never uploaded. These two have no setting in Obsidian; this file is the place to change them.

commands.json: a list. Each id runs once, ever, and its result is reported in status.json. To run something again, add it with a new id.

[
  { "id": "2026-10-29-a", "cmd": "reconcile" },
  { "id": "2026-10-29-b", "cmd": "reset-index" },
  { "id": "2026-10-29-c", "cmd": "lock" },
  { "id": "2026-10-29-d", "cmd": "pull", "paths": ["Notes/todo.md", "Projects"] },
  { "id": "2026-10-29-e", "cmd": "restore-all" }
]
CommandEffect
reconcileDoes nothing extra. Commands are read at the start of a reconcile, so this only confirms the channel works.
reset-indexForgets the index; every file is re-uploaded.
lockLocks the vault. Fails if no passphrase is set.
pullWrites the server's copy of the listed files or folders into the vault, unconditionally. Use it after editing files directly on the server.
restore-allWrites every indexed file that is missing or different locally.

pull and restore-all upload the local version to _trash/ before overwriting it, so nothing is lost on either side.

status.json: written by the plugin.

{ "at": "2026-11-02T18:00:00.000Z", "version": "1.4.0", "computer": "LAPTOP", "locked": false,
  "lastReconcile": { "at": "2026-11-02T18:00:00.000Z", "reason": "interval",
                     "files": 812, "uploaded": 3, "trashed": 0, "skipped": [] },
  "lastError": null, "settings": { "idleMinutes": 5, "…": "…" },
  "commands": { "2026-11-02-d": { "ok": true, "at": "…", "detail": "4 files written" } } }

at is when the file was written. lastError is null while the backup is healthy; when a backup fails, the plugin writes the file again with the error (if the server can still be reached) and retries every minute. lastReconcile is the last run that completed since Obsidian started (null before the first); skipped lists files over 100 MB. vlb status prints all of this per computer. A cron job can alert you when at is older than you expect, which means the computer has stopped backing up or Obsidian hasn't been opened.

Security model

What it does

  • The passphrase is never stored. Only a PBKDF2-SHA256 hash (200,000 iterations, random salt) is kept in the plugin's data.json.
  • Each wrong passphrase adds a growing delay, up to 5 seconds.
  • While locked, an overlay covers the whole window and pop-out windows go blank. Hotkeys and the command palette don't work, the Settings window is closed, and every window title shows only "Obsidian".
  • On lock, tabs showing private notes are closed and the private folder is renamed to a dot-folder (Private/ → .Private/). Obsidian ignores dot-folders completely: file explorer, search, graph and quick switcher. On Windows the folder also gets the hidden attribute.
  • If Obsidian crashes while unlocked, the folder is hidden again and the vault locks at the next start, before the interface appears.

What it does not do

  • No encryption. Notes, including the private folder, are plain files on disk and on the server. Anyone who can open the files, or delete the plugin's data.json, gets past the lock.
  • This computer's server key is stored in plain text in data.json. That file is never uploaded.
  • Whoever controls the server controls the plugin. Anyone who can write to a computer's folder can change its settings and use pull to overwrite notes. Local versions go to _trash/ first, but protect the server as carefully as the vault itself. Serve it over HTTPS only.
  • The server's address is built into the plugin, so it is public. Anyone can pair, but every computer gets its own sealed folder, so a stranger gets a small sandbox and never your notes: see Pairing.

To report a vulnerability, see SECURITY.md.

Troubleshooting

  • Lost passphrase. Close Obsidian. Delete <vault>/.obsidian/plugins/vault-lock-backup/data.json and rename .Private back to Private. Obsidian then asks for a new passphrase. Deleting data.json also deletes this computer's pairing: it pairs again as a new computer with a fresh folder. On the server, vlb move <new computer> <old folder> makes it continue the old folder instead.
  • "Both Private and .Private exist". This only happens if folders are created by hand. The plugin refuses to rename either one. Merge them manually.
  • Don't keep the vault in OneDrive, iCloud Drive or Dropbox. A second sync engine fighting over the Private ↔ .Private rename is the one thing that can corrupt this setup.
  • vlb status doesn't list the computer a minute after Obsidian started with the plugin. Pairing is paused (vlb open resumes it), the server is full (vlb status says FULL; vlb remove strangers), or vlb open --only names another computer. The plugin asks again every minute. Otherwise the computer is offline, or community plugins are turned off in Obsidian.
  • vlb status says never checked in although the computer is listed. The plugin can't complete a backup: see the next item, or wait a minute and look again.
  • vlb status says FROZEN for your computer. The server froze it as a stranger over the caps; it can't upload (nor report, so its last check-in stays put). vlb mine <its name> unfreezes it for good.
  • vlb status shows another ERROR, or the last check-in is old while Obsidian is open. The plugin retries every minute. The developer console in Obsidian (Ctrl+Shift+I) shows the [VLB backup] lines with the details.
  • The setup command says "Setup failed". It prints the reason. Fix it and run the same command again.
  • The backup fails right after you create a new DNS name. Your computer may have cached the old "not found" answer. Flush it (ipconfig /flushdns on Windows) or wait a few minutes.

Building and releasing

npm ci
npm run check   # type-check
npm run build   # -> main.js

To release: bump version in manifest.json (and package.json) and add a section to CHANGELOG.md. Then commit, tag with the same version and push:

git tag 1.0.1 && git push origin main 1.0.1

GitHub Actions builds main.js and publishes the release with notes from the changelog. BRAT installs it on the next Obsidian start. CI also runs scripts/test-install.ps1, which tests the setup command on Windows PowerShell 5.1.

License

MIT

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.