Vaultwarden is a lightweight server that speaks the Bitwarden API, so the official Bitwarden apps and browser extensions work with it. It runs happily in a small amount of RAM, which makes it a good fit for a VPS. Your vault is encrypted on your devices before it ever reaches the server, but the server still holds everything you care about, so treat it with care.

This guide covers Ubuntu 24.04 and Debian 12: install, HTTPS, the settings that matter, and backups you have actually restored.

Prerequisites

  • A VPS with root access and a domain name, such as vault.example.com, with an A (and AAAA) record pointing at it.
  • A basic hardened server: SSH keys, a firewall, automatic security updates.
  • Docker Engine and the Compose plugin from Docker's own repository:
sudo apt update && sudo apt install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings . /etc/os-release sudo curl -fsSL "https://download.docker.com/linux/$ID/gpg" -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$ID $VERSION_CODENAME stable" \ | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin 

1. Create an admin token hash

The /admin panel is protected by ADMIN_TOKEN. Do not put a plain password there. Vaultwarden can generate an Argon2 hash:

sudo docker run --rm -it vaultwarden/server:latest /vaultwarden hash 

Enter a long passphrase twice. The output is a line starting with $argon2id$. Keep the passphrase in your password manager of choice for now; you type the passphrase, not the hash, when you log in to /admin.

2. The Compose file

sudo mkdir -p /opt/vaultwarden && cd /opt/vaultwarden sudo nano compose.yaml 
services: vaultwarden: image: vaultwarden/server:latest container_name: vaultwarden restart: unless-stopped environment: DOMAIN: "https://vault.example.com" SIGNUPS_ALLOWED: "true" # set to "false" after you create your account  ADMIN_TOKEN: '$$argon2id$$v=19$$m=65540,t=3,p=4$$REPLACE$$WITH_YOUR_HASH' volumes: - ./data:/data ports: - "127.0.0.1:8080:80" 

Three details that trip people up:

  1. Every $ in the hash must be written as $$ in compose.yaml, otherwise Compose treats it as a variable and silently mangles the token. (If you move the token into an .env file instead, use single $ there and wrap the value in single quotes.)
  2. DOMAIN must be the exact HTTPS URL users visit. It is used for links in emails, attachments and WebAuthn.
  3. Bind to 127.0.0.1. Ports published by Docker bypass ufw, so "8080:80" would expose the plain-HTTP container to the internet. Only the reverse proxy should reach it.

Start it:

sudo docker compose up -d sudo docker compose logs --tail=30 

3. HTTPS with Caddy

The Bitwarden clients and the browser's Web Crypto API require HTTPS; plain HTTP will not work. Caddy gets and renews a certificate automatically:

sudo apt install -y caddy sudo nano /etc/caddy/Caddyfile 
vault.example.com { encode zstd gzip reverse_proxy 127.0.0.1:8080 { header_up X-Real-IP {remote_host} } } 
sudo caddy validate --config /etc/caddy/Caddyfile sudo systemctl reload caddy sudo ufw allow 80/tcp && sudo ufw allow 443/tcp 

Current Vaultwarden versions serve WebSocket notifications on the same port, so no extra proxy rule is needed.

4. Create your account, then close the door

  1. Open https://vault.example.com, create your account and log in.
  2. Set SIGNUPS_ALLOWED: "false" in compose.yaml and apply it:
cd /opt/vaultwarden sudo nano compose.yaml sudo docker compose up -d 
  1. In the web vault, turn on two-step login (Settings > Security > Two-step login). An authenticator app or a hardware key both work.

Need accounts for family or a team later? Invite them from the /admin panel instead of reopening sign-ups. Invitations need working SMTP (the SMTP_* variables in the Vaultwarden wiki); without email, you can briefly reopen sign-ups, let them register, and close again.

Important: settings saved in the /admin panel are written to data/config.json and override environment variables. If a change in compose.yaml seems to have no effect, check the admin panel.

5. Point your apps at it

In the Bitwarden app or browser extension, before logging in, choose the self-hosted server option and enter https://vault.example.com. Then log in with your account. Clients keep an encrypted local copy, so you can still read your vault if the server is briefly unreachable.

6. Backups that work

Everything lives in /opt/vaultwarden/data:

Path What it is
db.sqlite3 (+ -wal, -shm) the database: accounts, encrypted vault items
attachments/ file attachments
sends/ Bitwarden Send files
rsa_key* keys used to sign login tokens
config.json settings saved in the admin panel

Copying db.sqlite3 while the server is writing can give you a corrupted file. Use SQLite's online backup instead:

sudo apt install -y sqlite3 sudo nano /usr/local/sbin/vaultwarden-backup.sh 
#!/bin/bash set -euo pipefail SRC=/opt/vaultwarden/data DEST=/var/backups/vaultwarden STAMP=$(date +%F-%H%M) mkdir -p "$DEST/$STAMP" sqlite3 "$SRC/db.sqlite3" ".backup '$DEST/$STAMP/db.sqlite3'" cp -a "$SRC"/rsa_key* "$DEST/$STAMP/" [ -f "$SRC/config.json" ] && cp -a "$SRC/config.json" "$DEST/$STAMP/" [ -d "$SRC/attachments" ] && cp -a "$SRC/attachments" "$DEST/$STAMP/" [ -d "$SRC/sends" ] && cp -a "$SRC/sends" "$DEST/$STAMP/" tar czf "$DEST/vaultwarden-$STAMP.tar.gz" -C "$DEST" "$STAMP" && rm -rf "${DEST:?}/$STAMP" find "$DEST" -name 'vaultwarden-*.tar.gz' -mtime +14 -delete 
sudo chmod 700 /usr/local/sbin/vaultwarden-backup.sh sudo /usr/local/sbin/vaultwarden-backup.sh ls -lh /var/backups/vaultwarden/ 

Schedule it daily (cron or a systemd timer) and copy the archives off the server, for example with restic to another machine. The vault items inside are encrypted with your master password, but the archive still contains account metadata and keys, so keep it encrypted and private.

Test a restore

On a spare machine or a test VPS: install Docker, extract the archive into ./data, use the same compose.yaml, and start the container. Then open an SSH tunnel (ssh -L 8080:127.0.0.1:8080 test-vps) and browse to http://localhost:8080. Browsers treat localhost as a secure context, so the web vault loads without a certificate. Log in and open a few items. Seeing your data is the only proof the backup is good.

7. Updates

cd /opt/vaultwarden sudo /usr/local/sbin/vaultwarden-backup.sh sudo docker compose pull sudo docker compose up -d sudo docker image prune -f 

Back up first, every time. Read the release notes before major version jumps.

Hardening extras

  • Keep the /admin panel off when you do not need it: without an admin token the panel is disabled. Remove ADMIN_TOKEN from compose.yaml (and from data/config.json, if you saved one there) and run docker compose up -d.
  • Add fail2ban for failed logins: set LOG_FILE: "/data/vaultwarden.log" so the attempts are written to a file, and use the filter from the Vaultwarden wiki.
  • Monitor https://vault.example.com/alive with an uptime checker.

Where to host it

A password server needs little CPU and memory, a stable address and an owner who does backups. I work with PhantomVPS, which has a shorter Vaultwarden guide on its blog; its VPS plans include root access and can be paid in crypto, with no ID documents and no phone number at sign-up.