Anime-Sanctuary

Vaultwarden

A different password for every site is impossible to remember, so you end up reusing the same few. Let's install Vaultwarden, a password vault that runs on your own server.

Course
Tutorial 25 of 35
Time
45 min to read
Tested with
Vaultwarden 1.37.5, Docker 29.7.2, Apache 2.4 (Debian 13.7)
What you will be able to do
  • Start Vaultwarden with a Compose file, without exposing it to the Internet.
  • Create your account in private, then close sign-ups to strangers.
  • Publish it behind Apache over HTTPS, which the apps require.
  • Back up the volume, restore it, export the vault and update.

Before you start: Docker and Docker Compose, HTTPS with Let's Encrypt, Reverse proxy.

Contents
  1. What Vaultwarden does
  2. Write the Compose file
  3. Start it and check
  4. Create your account through an SSH tunnel
  5. Close sign-ups
  6. Switch to HTTPS behind Apache
  7. Back up the volume
  8. Export the vault
  9. Update
  10. Optional: the admin panel
  11. If it fails
  12. What's next
  13. Sources

How do you host your own password manager with Vaultwarden? You need a small configuration file of about fifteen lines, a domain name with HTTPS and some care with sign-ups. Plan on three quarters of an hour, optional step included. You end up with a vault that fills in your passwords from your browser and your phone, and whose data stays at home. The sticky notes under your keyboard can retire.

Two landmarks before we start. The server is the rented computer that runs around the clock and that you control from far away. The "On the server" blocks are typed in a terminal connected to it (see Your first SSH connection), and the "On your computer" blocks in a terminal opened at home. Also, exemple.fr, vault.exemple.fr and 203.0.113.10 are examples. Replace them with your own domain name and your server's address.

What Vaultwarden does

A password manager is a digital safe. It remembers a long, different password for every site, so you don't have to. You remember only one, the master password, which opens the safe. Vaultwarden is the server side of that safe, and you host it yourself.

It speaks the same language as Bitwarden, a well-known service of the same kind. So you use the official Bitwarden apps and browser extensions, and you simply give them your server's address instead of Bitwarden's.

The vault is encrypted on your device before it is sent, which means scrambled with a key drawn from your master password. The server only keeps unreadable text. That leaves two things to protect: access to the server and the master password. We add a second lock in step 3.

One rule applies: on the Internet, the web vault requires HTTPS, the encrypted version of the web (addresses starting with https://). Without it, the browser turns off its encryption tools, and the Bitwarden apps refuse the address too. Let's Encrypt provides the certificate that allows it, for free. There is a single exception: localhost, the address that means your own computer, which the browser considers safe. So our order is: start the container, create your account in private through an SSH tunnel (step 3), close sign-ups, then publish over HTTPS.

1Write the Compose file

Vaultwarden fits in a single container, with no separate database: it stores everything in SQLite, a database that lives in a single file. A container is a program started in its own isolated box. Docker Compose reads a file that describes that box. A volume is a folder that keeps the data when the box is replaced. The details are in Docker and Docker Compose. Let's create the folder and the file.

On the server
mkdir -p ~/vaultwarden
cd ~/vaultwarden
cat > docker-compose.yml <<'EOF'
services:
  vaultwarden:
    image: vaultwarden/server:1.37.5
    restart: unless-stopped
    environment:
      DOMAIN: https://vault.exemple.fr
      SIGNUPS_ALLOWED: "true"
    volumes:
      - vw-data:/data
    ports:
      - 127.0.0.1:8083:80

volumes:
  vw-data:
EOF

Here is what each important line does:

  • image: the official Vaultwarden image, pinned to one version. Changing this number is the only way to update (step 8).
  • restart: unless-stopped: Docker restarts the container after a crash or a server reboot, unless you stopped it yourself.
  • DOMAIN: the full public address, with https://. Vaultwarden uses it to write its links.
  • SIGNUPS_ALLOWED: set to "true", anyone can create an account. We leave it open while you create yours, then step 4 closes it.
  • vw-data:/data: the volume. The vault, meaning the database and the server's keys, lives in /data and survives any container update.
  • 127.0.0.1:8083:80: port 8083 on the server leads to port 80 in the container, and only for the server itself.

The file is ready. Let's start the container and check that it answers.

2Start it and check

The up -d command downloads the image, which takes a minute the first time, then starts the container in the background.

On the server
cd ~/vaultwarden
sudo docker compose up -d

Vaultwarden needs a few seconds to start. It offers a check address, /alive, which answers with the current time.

On the server
curl -s http://127.0.0.1:8083/alive
Expected output
"2026-11-05T02:58:41.869772Z"

A date in quotes appears, and yours will be different. If nothing shows up, wait ten seconds and run the command again. Now let's check that this port is open to the server only. The ss -ltn command lists the ports that are listening.

On the server
ss -ltn | grep 8083
Expected output
LISTEN 0      65535           127.0.0.1:8083       0.0.0.0:*

The address 127.0.0.1 confirms that only the server reaches this port. Nobody can sign up before you, so let's create your account before publishing anything.

3Create your account through an SSH tunnel

The site isn't public, so this is the right moment to create your account. To reach port 8083 from your computer, open an SSH tunnel: an SSH connection that lends one of the server's ports to your computer. In the command, -L 8083:127.0.0.1:8083 means that port 8083 on your computer leads to port 8083 on the server. Leave this window open.

On your computer
ssh -L 8083:127.0.0.1:8083 alice@203.0.113.10

Then open http://localhost:8083 in your browser. The browser accepts the vault without HTTPS here, because localhost never leaves your computer. Choose to create an account. The form asks for three things:

  • Your email address: it is your login.
  • A name: the one you want to see displayed.
  • The master password: the only one you will remember from now on.

For the master password, pick a long phrase, for example four or five unrelated words that you use nowhere else. Length matters more than symbols, and a phrase is easier to remember than a code.

Next, log in with this account and add a second lock: two-step login. On top of the master password, it asks for a six-digit code that changes every thirty seconds. The code comes from an authenticator app, a small free app on your phone (FreeOTP or Aegis, for example; search for "authenticator" in your phone's app store). In the account settings, under security, switch it on and follow the instructions. Also write down the recovery code you are given, in the same place as the master password. Your account exists, so now you can shut the door again.

4Close sign-ups

As long as SIGNUPS_ALLOWED is "true", anyone who knows the address can create an account on your server. Change it to "false", then recreate the container. The volume, and so your vault, stays in place.

On the server
cd ~/vaultwarden
sed -i 's/SIGNUPS_ALLOWED: "true"/SIGNUPS_ALLOWED: "false"/' docker-compose.yml
sudo docker compose up -d

Let's check that the door is really closed by trying to sign up. This command asks for an account for the address test@exemple.fr, and Vaultwarden must refuse.

On the server
curl -s -H 'Content-Type: application/json' -d '{"email":"test@exemple.fr","name":"test","receiveMarketingEmails":false}' http://127.0.0.1:8083/identity/accounts/register/send-verification-email | grep -o '"message":"[^"]*"' | head -1
Expected output
"message":"Registration not allowed or user already exists"

The refusal is clear. To welcome another person later, the cleanest way is to invite their email address from the admin panel, shown after step 8. Sign-ups stay closed for everyone else. Otherwise, set "true" again, recreate the container, let the person sign up, then close it right away.

Your server no longer accepts new accounts. Close the tunnel window with exit. The vault is ready and locked, and the next job is to publish it.

5Switch to HTTPS behind Apache

The container speaks plain HTTP. Apache, the web server, adds HTTPS by receiving visitors in its place. That is a reverse proxy, explained in Reverse proxy. Your account exists and sign-ups are closed, so you can publish. We first write a temporary site that proxies nothing. Certbot, the tool that asks Let's Encrypt for the certificate, uses it to prove that the domain is yours. The final site, with the proxy, comes after.

Start at your domain name provider and add an A record, a line in an address book that links a name to an IP address. Here it links vault.exemple.fr to 203.0.113.10. Then use a2enmod to switch on Apache's proxy and HTTPS modules, the options it needs here (Your first website with Apache introduces Apache and these commands). The command changes nothing if they are already on.

On the server
sudo a2enmod proxy proxy_http headers ssl
sudo systemctl restart apache2

Here is the temporary site. Port 80 doesn't lead to your vault yet.

On the server
sudo tee /etc/apache2/sites-available/vault.exemple.fr.conf > /dev/null <<'EOF'
<VirtualHost *:80>
    ServerName vault.exemple.fr
</VirtualHost>
EOF

Enable the site with a2ensite. Check the syntax with configtest, which rereads the settings files and flags a typo before it breaks the site. Then reload with reload, which applies the new settings without cutting off current visitors. After that, ask for the certificate. With certonly, Certbot proves the domain is yours, fetches the certificate and doesn't touch any Apache file.

On the server
sudo a2ensite vault.exemple.fr.conf
sudo apache2ctl configtest
sudo systemctl reload apache2
sudo certbot certonly --apache -d vault.exemple.fr

The certificate is ready in /etc/letsencrypt/live/vault.exemple.fr/. Now let's rewrite the site in its final version. Port 80 redirects to HTTPS, and the proxy exists only on the HTTPS side.

On the server
sudo tee /etc/apache2/sites-available/vault.exemple.fr.conf > /dev/null <<'EOF'
<VirtualHost *:80>
    ServerName vault.exemple.fr
    Redirect permanent / https://vault.exemple.fr/
</VirtualHost>

<VirtualHost *:443>
    ServerName vault.exemple.fr
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/vault.exemple.fr/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/vault.exemple.fr/privkey.pem
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8083/ upgrade=websocket
    ProxyPassReverse / http://127.0.0.1:8083/
    RequestHeader set X-Forwarded-Proto "https"
    ErrorLog ${APACHE_LOG_DIR}/vault-error.log
    CustomLog ${APACHE_LOG_DIR}/vault-access.log combined
</VirtualHost>
EOF

The upgrade=websocket option lets WebSockets through, connections that the browser keeps open. Vaultwarden uses them to tell your devices as soon as a password changes. The Apache in Debian 13 is recent enough for it. Check the syntax and reload.

On the server
sudo apache2ctl configtest
sudo systemctl reload apache2
Expected output
Syntax OK
What about the proxy_wstunnel module, mentioned in other articles?

Older Apache versions (before 2.4.47) needed this module for WebSockets. That is no longer true: with the upgrade=websocket option, the connection works without it, which we checked on an isolated Apache 2.4. Without the option, Apache refuses with error 426 ("upgrade required"), even with the module loaded.

Let's test from your computer, with the same check address as before.

On your computer
curl -s https://vault.exemple.fr/alive

A date in quotes should appear, this time through Apache and over HTTPS. The vault is finally reachable, and only over HTTPS.

Now connect your devices. In the Bitwarden browser extension or app, choose the self-hosted server option before logging in, and enter the address https://vault.exemple.fr. Log in with the account you created in step 3. Next, let's protect what it holds.

6Back up the volume

Everything Vaultwarden remembers is in the volume, so backing up means copying its content. Stop the container first, because an SQLite database copied while it is being written to can come out damaged. The copy uses tar, which packs files into an archive. It runs in a throwaway container built from alpine:3.20, a small Linux image.

Compose puts the folder name in front of the volume name, so here it is called vaultwarden_vw-data. Docker creates the archive under the name of root, the administrator account.

The last line of the block fixes that. chown gives the archive back to you, and chmod 600 keeps it for you alone.

On the server
cd ~/vaultwarden
sudo docker compose stop
sudo docker run --rm -v vaultwarden_vw-data:/donnees:ro -v "$PWD":/sauvegarde alpine:3.20 tar czf /sauvegarde/vaultwarden-donnees.tar.gz -C /donnees .
sudo docker compose start
sudo chown "$USER" vaultwarden-donnees.tar.gz && chmod 600 vaultwarden-donnees.tar.gz

The vault is offline for only a few seconds. Let's check that the archive holds the database (db.sqlite3) and the server's private key (rsa_key.pem, which signs your devices' logins). The command must print 2.

On the server
tar tzf vaultwarden-donnees.tar.gz | grep -c -E 'db.sqlite3$|rsa_key.pem$'
Expected output
2

The vault's content is encrypted, but this archive must not lie around. Whoever copies it can attack your master password at leisure, at home. Copy it to another computer, for example with rsync, because a backup that stays on the server won't help if the server dies.

Restore a backup

Restoring means putting the archive back into the volume, with the container stopped. The files in the archive replace those in the volume.

On the server
cd ~/vaultwarden
sudo docker compose stop
sudo docker run --rm -v vaultwarden_vw-data:/donnees -v "$PWD":/sauvegarde alpine:3.20 tar xzf /sauvegarde/vaultwarden-donnees.tar.gz -C /donnees
sudo docker compose start

The archive covers the case where the server dies. For the case where you want to leave Vaultwarden, you need another copy.

7Export the vault

An export is a copy of your passwords in a file that other managers can read. In the web vault, open the tools menu, choose the vault export, then a format. JSON and CSV are text files that many tools read. Prefer the encrypted JSON: a password, set at that moment, protects it.

Redo this export from time to time and keep it with the volume backup. Two copies in different forms beat one. Last, let's see how to follow new versions.

8Update

An update replaces the container with a newer one that reuses the same volume. Back up first, as in step 6. Then change the number after vaultwarden/server: in the file. Open it with nano ~/vaultwarden/docker-compose.yml (Ctrl+O and Enter save, Ctrl+X quits; The terminal for beginners covers nano). Then download and recreate.

On the server
cd ~/vaultwarden
sudo docker compose pull
sudo docker compose up -d

To read the version that is running, ask the container.

On the server
sudo docker compose exec vaultwarden /vaultwarden --version
Expected output
Vaultwarden 1.37.5

The number shown must be the one you wrote in the file. One optional setting is left, for inviting other people.

Optional: the admin panel

Sign-ups are closed, so how do you welcome someone else? The admin panel is the answer. Skip this chapter if you are alone.

Vaultwarden has an admin page, /admin, to invite people or delete accounts. It stays off until you set a token, a password just for that page. Never write it in clear text. Vaultwarden accepts its hash instead, a text computed from the token that doesn't let anyone recover the token. To compute it, the command below runs Vaultwarden just long enough to do the math. It asks for the token twice without showing it: type it blind, then press Enter.

Why this computation is slow

The hash computation (Argon2id) is slow on purpose, to discourage mass guessing. The command's -it option lets you type the token.

On the server
sudo docker run --rm -it vaultwarden/server:1.37.5 /vaultwarden hash
Expected output
Generate an Argon2id PHC string using the 'bitwarden' preset:

Password:
Confirm Password:

ADMIN_TOKEN='$argon2id$v=19$m=65540,t=3,p=4$M4CpooFicL0/uv1ja+9/r6e2Gh6u5CyDxqmjhcrKu/4$RFVUgDqN8nEmNz6vpmDtA53Ql1+YoD4kmpy3g36qxuE'

The hash shown here comes from an example token, and yours will be different every time. Store it in a .env file, a small settings file that Compose reads on its own. The block below creates it readable by you alone, then opens it in the nano editor.

On the server
cd ~/vaultwarden
install -m 600 /dev/null .env
nano .env

In nano, paste the ADMIN_TOKEN= line exactly as displayed, quotes included. To copy it, select it with the mouse in the terminal and press Ctrl+Shift+C (Cmd+C on a Mac). Paste with Ctrl+Shift+V (Cmd+V). Without the quotes, Compose would take each $ sign for the start of a name to replace, and would damage the hash. Then Ctrl+O and Enter save, and Ctrl+X quits.

In docker-compose.yml, add the following line under environment:, with the same indentation as DOMAIN, then recreate the container.

In docker-compose.yml
      ADMIN_TOKEN: ${ADMIN_TOKEN}
On the server
sudo docker compose up -d

The page https://vault.exemple.fr/admin then asks for your token, the one you typed, not the hash. To invite someone, open the users tab, enter their email address and confirm.

With no mail server set up, no message goes out. Tell the person yourself, and they sign up on your vault's page with exactly that address. Sign-ups stay closed for everyone else. To turn the panel off, remove the line and recreate the container.

If it fails

Five situations are worth knowing. In every case, sudo docker compose logs shows what Vaultwarden has to say:

  • Account creation fails or the page stays blank. You are probably on HTTP. Open the address with https://, because the browser refuses encryption on an insecure page.
  • Registration not allowed or user already exists. Sign-ups are closed (step 4), or the email address already has an account. To sign someone up, invite them from the admin panel, or reopen sign-ups while they create their account.
  • The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it. No token is set. That is the normal setting, with no admin panel.
  • Invalid admin token, please try again. You typed the hash instead of the token, or the token has a typo. Type the one you chose when you ran the hash command.
  • An Apache 503 error. The container is stopped or isn't listening on port 8083. Run sudo docker compose ps. If the container isn't "Up", start it with sudo docker compose up -d and read sudo docker compose logs.

What's next

Your passwords are at home, behind HTTPS, with a backup and an export. One question remains: does your whole server really need to be visible on the Internet? For some services, the answer is no, and a private tunnel between your devices and your server solves it. The next article, WireGuard, sets it up.

Sources (accessed November 4, 2026)

  • Vaultwarden: official image on Docker Hub.
  • Bitwarden: master password (no way to recover it), vault export.
  • Browser: secure contexts (MDN). Apache: mod_proxy.
  • Commands: tested on Debian 13 for Apache and on Docker 29.7.2 for Vaultwarden. Invitation through the admin panel checked without a mail server. WebSocket without proxy_wstunnel checked on an isolated Apache 2.4. Open sign-up then refusal after closing, and panel disabled without an ADMIN_TOKEN line, checked on the local port. The parts that go through a browser or an outside service (certbot, DNS, SSH tunnel, account creation, two-step login, export, Bitwarden apps) follow the official documentation and were not replayed here. If something goes wrong, see "If it fails".