Self-Hosting Vaultwarden on a $5 VPS: The Complete 2026 Setup
Bottom line: Vaultwarden gives you a Bitwarden-compatible password manager for the
price of a domain name. It runs in about 60 MB of RAM, the official Bitwarden apps
talk to it without modification, and the whole stack is one Docker Compose file plus
a reverse proxy. The parts that trip people up are not the container — they are TLS,
the admin token format, and whether the backup can actually be restored.
This guide covers all four, in the order you hit them.
Why Vaultwarden instead of Bitwarden’s cloud
Bitwarden’s own server is a .NET stack that wants several gigabytes and a handful of
services. Vaultwarden is a single Rust binary that speaks the same API, which means
the official desktop, browser and mobile clients work against it unchanged.
The trade-off is honest and worth stating plainly:
| Bitwarden cloud | Vaultwarden self-hosted | |
|---|---|---|
| Cost | $10/year Premium | VPS + domain (~$40/year) |
| Data location | Vendor’s servers | Your disk |
| Mobile clients | Official | Official, unchanged |
| Updates | Automatic | You run docker compose pull |
| Failure mode | Vendor outage | Your server, your problem |
| Break-glass access | Vendor support | Your backup |
If losing access to your passwords because you forgot to renew a VPS sounds worse
than paying $10 a year, self-hosting is the wrong choice. If you want the vault to
live on hardware you control and you are willing to run a backup, it is excellent.
What you need
- A VPS with 1 vCPU and 1 GB RAM is enough. Vaultwarden idles at roughly 30–60 MB RSS.
- A domain or subdomain, e.g.
vault.example.com. - Ports 80 and 443 reachable from the internet — Let’s Encrypt needs port 80 for the
HTTP-01 challenge unless you use DNS-01. - Docker and the Compose plugin installed.
The Bitwarden clients refuse to connect over plain HTTP. TLS is not optional here, so
budget the reverse proxy step; it is not a “later” task.
Step 1 — Docker and a data directory
1 | sudo apt update && sudo apt install -y docker.io docker-compose-plugin |
Vaultwarden’s container runs as UID 1000. If the data directory is owned by root, the
container starts and then fails to write db.sqlite3, and the log line you see is a
generic SQLite error rather than a permission message. That mismatch costs people an
hour.
Step 2 — The Compose file
1 | services: |
Three decisions in that file matter more than the rest.
127.0.0.1:8080:80 — the container is bound to loopback only. It is never exposed
directly to the internet; all traffic arrives through the reverse proxy. Publishing it
as 8080:80 instead would let anyone bypass TLS by hitting port 8080.
SIGNUPS_ALLOWED: "false" — set this before the first launch if the instance is
only for you. With signups open, anyone who finds the URL can create an account, and
Vaultwarden does not email-verify by default. You invite yourself from the admin panel
instead.
DOMAIN — must be the exact HTTPS URL, including scheme, with no trailing slash.
The clients use it to build WebSocket and API URLs. A mismatch here produces a vault
that syncs once and then silently stops receiving updates.
Store the token in a .env file next to the compose file, mode 600:
1 | cd /opt/vaultwarden |
Then start it:
1 | sudo docker compose up -d |
Step 3 — TLS with Caddy
Caddy is the shorter path because it obtains and renews certificates on its own.
1 | vault.example.com { |
If you are on Nginx instead, the WebSocket block is the part people omit, and the
symptom is subtle: sync works, but the vault does not update until you manually
refresh.
1 | location / { |
Verify the certificate before going further:
1 | curl -sSI https://vault.example.com/alive | head -3 |
A 200 here means TLS terminates and the proxy reaches the container. Do not continue
until this passes — every later failure looks like a client bug when it is actually
this.
Step 4 — The admin panel and its token format
Visit /admin. Vaultwarden accepts ADMIN_TOKEN either as a plain string or as an
Argon2 hash. The plain string is fine for a first boot, but it is stored in your shell
history and in .env in cleartext.
To store only a hash:
1 | docker run --rm -it vaultwarden/server /vaultwarden hash |
Paste the resulting $argon2id$... string into ADMIN_TOKEN, quoting it in YAML so the$ characters are not interpreted. If the panel rejects the token after that change,
the usual cause is a shell that expanded the $argon2id variable duringdocker compose up. Single quotes in .env, or a docker compose run from a file
rather than an inline command, avoids it.
From the admin panel, create your own account invitation. Then setSIGNUPS_ALLOWED: "false" if you have not already, and restart:
1 | sudo docker compose up -d |
Step 5 — Connecting the clients
In the Bitwarden app, before logging in, open the region/self-hosted setting:
- Desktop and browser extension: the gear icon on the login screen → Self-hosted
environment → set the server URL tohttps://vault.example.com. - iOS and Android: on the login screen, tap the region selector and enter the same URL.
The URL must include https://. Without the scheme the client guesses, and the guess
is wrong.
Two features behave differently from the cloud product:
- Emergency access works between accounts on the same instance only.
- Sends work, but file size is limited by your reverse proxy body limit. Caddy
defaults to no limit; Nginx defaults to 1 MB, which breaks attachments until you setclient_max_body_size 100M;.
Step 6 — A backup you can actually restore
This is the step that decides whether the project was worth doing. The vault lives in
four places under /data:
| Path | What it is | Consequence if lost |
|---|---|---|
db.sqlite3 |
Accounts, items, folders | Everything |
attachments/ |
Uploaded files | File attachments gone |
sends/ |
Bitwarden Send payloads | Shared links dead |
rsa_key* |
Instance signing keys | Existing sessions invalidated |
config.json |
Admin panel settings | Settings reset |
SQLite must not be copied while it is being written. Use SQLite’s own backup command
inside the running container rather than cp:
1 |
|
Add it to cron and, more importantly, test the restore once:
1 | sudo docker compose down |
An untested backup is a hope, not a backup. Do this on a second machine if you can.
Pitfalls that cost the most time
| Symptom | Cause | Fix |
|---|---|---|
| Vault syncs once, then stops | WebSocket route missing in proxy | Add the /notifications/hub upgrade block |
docker compose up fails on $argon2id |
Shell expanded the variable | Quote it in .env, avoid inline env |
| Container restarts in a loop, SQLite error | /data owned by root |
chown 1000:1000 the directory |
| Attachments fail over ~1 MB | Nginx client_max_body_size |
Raise it to 100M |
| Clients say “cannot reach server” | DOMAIN missing https:// |
Fix the env var and restart |
| Admin panel 404 | ADMIN_TOKEN unset |
Set it; the route is not mounted without it |
| 2FA/TOTP fails | Server clock drift | Enable systemd-timesyncd or chrony |
Is this actually cheaper than $10 a year?
Run the numbers honestly. A 1 GB VPS is $3–5/month, a domain is $10–15/year, and
you will spend an afternoon on setup plus a few minutes a month on updates. That is
roughly $50/year against Bitwarden’s $10.
The argument for self-hosting is not cost. It is that the vault, its encryption keys
and its backup live where you can see them, and no subscription lapse can lock you out
of your own accounts. If that is worth $40 and an afternoon, build it. If not, pay the
$10 and spend the afternoon on something else.
FAQ
Do I need a separate domain for this?
No. A subdomain of a domain you already own is fine, and Caddy will get a certificate
for it automatically. What you cannot do is run it on a bare IP address, because the
clients require a valid TLS certificate.
Can I migrate from Bitwarden cloud without re-entering every password?
Yes. Export your vault from the cloud account as JSON or encrypted JSON, then import
it into the self-hosted account. Use the encrypted export — the plaintext one leaves a
file on disk that contains every password you own.
Does Vaultwarden support WebAuthn / hardware keys for 2FA?
Yes, but only over HTTPS with the correct domain set in DOMAIN. WebAuthn binds the
credential to the origin, so if you later move the vault to a different hostname, every
registered hardware key stops working and you must re-register them.
How do I update it safely?
docker compose pull && docker compose up -d. Take a database backup first — the
project occasionally ships migrations, and downgrading after a migration is not
supported. Pin a specific tag instead of latest if you want to control when that
happens.
What happens if the VPS dies?
Whatever your backup strategy says happens. With the script above, you restore the
SQLite file and the keys onto a new machine, point DNS at it, and the clients reconnect
with the same master password. Without a backup, the data is gone — the vault is
encrypted with keys that only exist on that disk.
Is it safe to put a password vault on a VPS?
The vault is encrypted at rest with a key derived from your master password, so a disk
image does not expose the passwords. The realistic risks are operational: an
unpatched container, a leaked admin token, or a backup stored unencrypted. Address
those three and the setup is sound.











