noted.do
@alextut

How I Set Up My Own Password Manager With Vaultwarden

I've been self-hosting more of my own services lately, so eventually I started thinking about something a little more important than files and photos:

Passwords.

I didn't really want another random password manager server sitting somewhere that I had no control over.

That's when I came across Vaultwarden.

Vaultwarden is a lightweight, Bitwarden-compatible password manager server written in Rust. It isn't the official Bitwarden server, but it works with Bitwarden-compatible clients and can be self-hosted on your own server.

And the nice thing is that it doesn't require a massive server.

A small VPS, mini PC, or home server can handle it.

What we're building

The setup I'm going for looks like this:

                    Internet
                       │
                       ↓
              vault.example.com
                       │
                       ↓
                HTTPS / Proxy
                       │
                       ↓
                 Vaultwarden
                       │
                       ↓
                 Server Storage

I'll be using:

  • Ubuntu Server

  • Docker

  • Docker Compose

  • Vaultwarden

  • A domain or subdomain

  • HTTPS

  • A reverse proxy

  • Regular backups

For this example, I'll use:

vault.example.com

Obviously, replace that with your own domain.


Step 1 — Prepare the server

I'm assuming you already have an Ubuntu server available.

First, update it:

sudo apt update
sudo apt upgrade -y

Then make sure Docker is installed:

docker --version

And Docker Compose:

docker compose version

If both commands return a version number, you're ready to go.

If you don't have Docker installed yet, use the official Docker installation instructions rather than copying a random installation script from a blog.


Step 2 — Create the Vaultwarden directory

I like keeping each self-hosted service in its own directory.

Create one for Vaultwarden:

sudo mkdir -p /opt/vaultwarden
cd /opt/vaultwarden

We'll also create a directory for the actual Vaultwarden data:

sudo mkdir -p /srv/vaultwarden
sudo chmod go-rwx /srv/vaultwarden

The important thing here is that Vaultwarden's /data directory needs to persist outside the container. Otherwise, removing the container could mean removing the data along with it.


Step 3 — Create Docker Compose

Create the Compose file:

nano compose.yaml

Put this inside:

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped

    environment:
      DOMAIN: "https://vault.example.com"
      SIGNUPS_ALLOWED: "true"

    volumes:
      - /srv/vaultwarden:/data

    ports:
      - "127.0.0.1:8080:80"

Save the file.

The important part here is:

- /srv/vaultwarden:/data

That's what keeps your Vaultwarden data on the server instead of inside the temporary container.

The official Vaultwarden project recommends using its container image and persistent /data storage.


Step 4 — Start Vaultwarden

Now start it:

docker compose up -d

Check that it's running:

docker ps

You should see something similar to:

vaultwarden

If you want to see what Vaultwarden is doing:

docker logs vaultwarden

At this point Vaultwarden is running, but don't expose it directly to the internet yet.

We still need HTTPS.


Step 5 — Set up your domain

Create a subdomain for Vaultwarden.

For example:

vault.example.com

Create an A record pointing the subdomain to your server's public IP.

Your DNS should look something like:

Type: A

Name: vault

Value: YOUR.SERVER.IP

Then:

vault.example.com
        ↓
   Your Server
        ↓
   Vaultwarden

If you're using Cloudflare, you can manage the DNS record there.


Step 6 — Put Vaultwarden behind HTTPS

This is not optional for a public Vaultwarden installation.

Vaultwarden's documentation recommends putting it behind a reverse proxy for HTTPS. HTTPS is also important for functionality such as WebAuthn/U2F.

You can use:

  • Caddy

  • Nginx

  • Nginx Proxy Manager

  • Traefik

  • Another reverse proxy you're comfortable with

Since I already use reverse proxies for my other self-hosted applications, I would simply create a proxy entry for:

vault.example.com

and point it to:

127.0.0.1:8080

The basic flow becomes:

Internet
   ↓
HTTPS
   ↓
Reverse Proxy
   ↓
127.0.0.1:8080
   ↓
Vaultwarden

The nice thing about doing this is that Vaultwarden itself doesn't need to be directly exposed to the internet.


Step 7 — Generate the admin token

Vaultwarden has an administrative interface available at:

https://vault.example.com/admin

But you should protect it properly.

Recent Vaultwarden versions support an Argon2-based admin token, and the project provides a built-in hashing command.

Run:

docker exec -it vaultwarden /vaultwarden hash

Vaultwarden will ask for a password and generate an Argon2 hash.

Copy the entire result.

It will look roughly like:

$argon2id$v=19$...

Don't copy that example. Generate your own.


Step 8 — Add the admin token

Edit your Compose file:

nano compose.yaml

Add:

environment:
  DOMAIN: "https://vault.example.com"
  SIGNUPS_ALLOWED: "true"
  ADMIN_TOKEN: '$argon2id$YOUR_GENERATED_HASH'

One important detail: because Docker Compose treats $ specially, the hash may need its dollar signs escaped as $$, depending on how you're defining the value. Vaultwarden's configuration documentation specifically calls this out for Compose deployments.

A safer approach is to use an .env file and handle the value carefully.

After changing the configuration:

docker compose up -d

Step 9 — Create your account

Now visit:

https://vault.example.com

Create your Vaultwarden account.

Once you're finished creating the account, disable public registration.

Edit your configuration:

SIGNUPS_ALLOWED: "false"

Then recreate the container:

docker compose up -d

This is an important step.

You don't want random people discovering your server and being able to create accounts.

If you need to add another user later, you can use invitations/organization functionality instead of leaving registration open.


Step 10 — Open the Admin Panel

Go to:

https://vault.example.com/admin

Enter your admin token.

You'll now have access to Vaultwarden's administrative settings.

This is useful for managing things like:

  • Users

  • Invitations

  • Configuration

  • SMTP

  • Organizations

  • Server information

Just remember that the admin panel is extremely sensitive.

I'd avoid exposing /admin unnecessarily if your setup allows you to restrict access further.


Step 11 — Configure email

Email isn't absolutely required for Vaultwarden to run, but it becomes very useful.

You can configure SMTP for things like:

  • Email verification

  • Invitations

  • Password-related emails

  • Organization invitations

  • Notifications

Your SMTP settings will depend on your email provider.

For example:

SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURITY=starttls
SMTP_FROM=vault@example.com
SMTP_USERNAME=your-user
SMTP_PASSWORD=your-password

Don't paste your real SMTP password into a public tutorial or Git repository.

And be careful about where you store it. Depending on how Vaultwarden is configured, credentials can end up in configuration files, so permissions on the data directory matter.


Step 12 — Install the Bitwarden apps

Here's the really nice part.

You don't need to build a custom client.

Vaultwarden is compatible with Bitwarden clients.

That means you can use the official Bitwarden applications on supported platforms and point them at your Vaultwarden server.

You can use:

  • Browser extensions

  • Windows

  • macOS

  • Linux

  • iPhone

  • Android

Instead of logging into the normal Bitwarden cloud server, configure the client to use your own Vaultwarden server.

For example:

Server URL:

https://vault.example.com

Now your password vault is connected to your own server.


Step 13 — Turn on 2FA

This is one thing I wouldn't skip.

Once your account is working, enable two-factor authentication.

Your password manager is probably one of the worst places to have a single point of failure.

If somebody gets your master password, you don't want that to automatically mean they have your entire vault.

Use a strong master password and enable an additional authentication method supported by your setup.


Step 14 — Back up Vaultwarden

This is the most important part of the entire tutorial.

A password manager without a backup is a disaster waiting to happen.

Your Vaultwarden data lives under:

/srv/vaultwarden

That directory should be backed up regularly.

For example:

Vaultwarden
     │
     ├── Primary Server
     │
     ├── Local Backup
     │
     └── Off-Site Backup

I'd personally want at least one backup stored somewhere other than the same physical machine.

And don't just create backups.

Test restoring one.

That's how you know your backup actually works.


Step 15 — Don't forget your backup encryption

There's another important issue with password-manager backups.

Your backup contains extremely sensitive information.

You don't want to upload an unencrypted copy of your Vaultwarden data to some random storage bucket.

If you're sending backups off-site, encrypt them first.

Your backup system should look more like:

Vaultwarden
     ↓
Encrypted Backup