On this page
- What is Vaultwarden and what do you need?
- How do you create a hashed admin token?
- What goes into the Compose file?
- How do you serve it over HTTPS with Caddy?
- How do you close sign-ups and use the admin page?
- How do you configure mail for invitations?
- How do you back up the vault?
- How do you update and troubleshoot Vaultwarden?
- Questions
What is Vaultwarden and what do you need?
Vaultwarden is a lightweight server written in Rust that speaks the Bitwarden client API. It runs in a single container, uses SQLite by default and needs very little memory, which makes it a good fit for the smallest plans.
- Ubuntu 24.04 or Debian 12/13 with Docker and Compose. The Docker app image already has both; otherwise follow Docker Engine install.
- A host name such as
vault.example.netwith A and AAAA records. HTTPS is not optional: the browser clients refuse to use their crypto functions on plain HTTP. - A firewall that allows SSH, 80 and 443 only.
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enableHow do you create a hashed admin token?
Generate the token with the hash helper built into the image; it asks for a password twice and prints an Argon2 string you store instead of the plain password.
sudo mkdir -p /opt/vaultwarden/data && cd /opt/vaultwarden
sudo docker run --rm -it vaultwarden/server:latest /vaultwarden hashCopy the line that starts with $argon2id$ into /opt/vaultwarden/.env, wrapped in single quotes so Compose does not try to expand the dollar signs:
VW_ADMIN_TOKEN='$argon2id$v=19$m=65540,t=3,p=4$...rest-of-the-hash...'sudo chmod 600 /opt/vaultwarden/.envThe password you typed is what you enter on the admin page later. Keep it in a separate place from the vault itself, since you might need the admin page to recover from a problem with your own account.
What goes into the Compose file?
A single service with the public URL, sign-up switch, admin token and a data volume is all Vaultwarden needs. Save this as /opt/vaultwarden/docker-compose.yml:
services:
vaultwarden:
image: vaultwarden/server:latest
container_name: vaultwarden
restart: unless-stopped
environment:
DOMAIN: "https://vault.example.net"
SIGNUPS_ALLOWED: "true"
ADMIN_TOKEN: ${VW_ADMIN_TOKEN}
LOG_LEVEL: warn
volumes:
- /opt/vaultwarden/data:/data
ports:
- "127.0.0.1:8080:80"cd /opt/vaultwarden
sudo docker compose up -d
curl -s http://127.0.0.1:8080/aliveThe /alive endpoint returns a timestamp when the server is ready. Binding the port to loopback matters, because Docker port rules bypass ufw; only Caddy should reach the container. Recent releases serve WebSocket notifications on the same port, so no second port is needed.
How do you serve it over HTTPS with Caddy?
Install Caddy from its official repository and add one site block that proxies to the container; Caddy requests and renews the certificate itself.
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update && sudo apt install -y caddyvault.example.net {
encode zstd gzip
reverse_proxy 127.0.0.1:8080 {
header_up X-Real-IP {remote_host}
}
}sudo systemctl reload caddy
curl -I https://vault.example.netOpen the address in a browser, choose Create account, and set a long master password. The Caddy HTTPS tutorial explains logging and adding more sites.
How do you close sign-ups and use the admin page?
Once your own account exists, turn public registration off and invite other people from the admin page instead.
cd /opt/vaultwarden
sudo sed -i 's/SIGNUPS_ALLOWED: "true"/SIGNUPS_ALLOWED: "false"/' docker-compose.yml
sudo docker compose up -dVisit https://vault.example.net/admin and enter the admin password from the hash step. From there you can invite users by email, disable accounts, view the diagnostics page and change many settings. Settings saved in the admin page go to /data/config.json and take priority over environment variables, which surprises people later; check that file when an environment change seems to have no effect.
Encourage every user to enable two-step login in their account settings, and consider adding fail2ban rules that read the Vaultwarden log for repeated failed logins.
How do you configure mail for invitations?
Add SMTP variables for an authenticated relay on port 587 with STARTTLS, recreate the container, and send a test mail from the admin diagnostics page.
SMTP_HOST: smtp.example.net
SMTP_FROM: vault@example.net
SMTP_FROM_NAME: Vault
SMTP_PORT: "587"
SMTP_SECURITY: starttls
SMTP_USERNAME: vault@example.net
SMTP_PASSWORD: change-meInvitations, new device notices and email two-step codes all rely on this. Direct sending from the VPS over port 25 is not promised, so ask support in a ticket before you plan it; the relay route on 587 is the dependable path. Send app mail through an SMTP relay covers the relay account and SPF and DKIM records.
How do you back up the vault?
Take a consistent SQLite copy with the .backup command and archive it together with the attachment folder, keys and config, every night.
sudo apt install -y sqlite3
sudo sqlite3 /opt/vaultwarden/data/db.sqlite3 ".backup '/root/vw-db-$(date +%F).sqlite3'"
sudo tar -czf /root/vw-files-$(date +%F).tar.gz -C /opt/vaultwarden/data \
attachments sends config.json rsa_key.pem
ls -lh /root/vw-*Some folders only appear after first use, so drop any that tar reports as missing. Put the two commands in a root cron job, then copy the files off the server with restic or rsync. Vault contents are encrypted with each user's master password, yet the backup still deserves care because it holds metadata and the server keys. The daily backups tutorial pairs the add-on with restic.
How do you update and troubleshoot Vaultwarden?
Pull the new image and recreate the container; database migrations run automatically on start.
cd /opt/vaultwarden
sudo docker compose pull
sudo docker compose up -d
sudo docker image prune -f
sudo docker compose logs --tail 50 vaultwarden- Browser extension shows a crypto or secure context error: you opened the vault over HTTP or through a mismatched
DOMAIN. - Admin page says the token is invalid: the hash lost characters because the dollar signs were expanded; put it back in single quotes.
- Changes in Compose do nothing: the same key exists in
config.jsonfrom the admin page.
Read release notes before large version jumps, and take a backup first.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Vaultwarden password vault
Do the normal Bitwarden apps work with Vaultwarden?
Yes. In the app or extension, choose the self-hosted server option before logging in and enter https://vault.example.net.
How much memory does it use?
Very little: a family instance usually stays well under 100 MB. The smallest plans run it comfortably alongside a few other containers.
Should I use PostgreSQL or MySQL instead of SQLite?
For a personal or family vault SQLite is simpler to back up. Larger groups can set DATABASE_URL to a PostgreSQL or MySQL database.
Can I keep the vault private to my VPN?
Yes. Bind Caddy only to the VPN interface or use a WireGuard tunnel and restrict ports 80 and 443 to it; you then need a DNS challenge for the certificate.
What if I forget my master password?
Nobody can decrypt the vault without it, including the admin. Use the emergency access feature or keep a sealed copy of the password offline.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- Wiki.js
- BookStack documentation
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- VS Code in the browser (code-server)
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Leantime project management
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- Mautic marketing automation
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM