Vaultwarden Admin Token: Generate, Store, and Verify It

Keep the Vaultwarden admin password in a restricted password manager, and keep its Argon2id hash in protected deployment configuration. Put only a variable reference in your Compose file. Use the original password to sign in to /admin over trusted HTTPS.

If your only copy of the admin password is in the Vaultwarden instance it manages, arrange an independent way for an authorized operator to retrieve it before you enable the panel.

Decide where each value belongs

Value Where to keep it Where it must stay out
Original admin password A restricted operator vault with an independent access route, or a protected offline recovery copy. Compose YAML, command arguments, shell history, shared chat, screenshots, articles and public repositories.
Argon2id PHC hash A private file outside the repository, readable only by the deployment user, or the equivalent protected secret storage. If managed by the admin panel, protect the persisted config.json and its backups. Articles, public repositories, sample files, support tickets, build logs, screenshots and unencrypted backups. A leaked hash can be tested offline against guessed passwords.
Variable name and placeholder Documentation, version-controlled Compose and example configuration. Keep the real value out of each example.

Generate the hash and pass it to Compose

From a private terminal in the Compose project, run the built-in generator on the running vaultwarden service. It prompts for the password interactively. Generate a long, unique password and keep the terminal output private.

docker compose exec vaultwarden /vaultwarden hash

In this example the private file is /secure/vaultwarden/admin.env. Restrict it to the deployment account, for example with owner-only permissions on Linux, before writing the hash. Put the generated value in single quotes in that file. Preserve the dollar signs as generated. The sample below is a placeholder.

VAULTWARDEN_ADMIN_TOKEN='REPLACE_WITH_ARGON2ID_PHC_HASH'

Add this entry under the existing service’s environment mapping. The Compose file can carry the reference without carrying the hash.

ADMIN_TOKEN: "${VAULTWARDEN_ADMIN_TOKEN:?set_in_private_env_file}"

Validate without printing the resolved configuration, then apply the change. Use the same environment-file options on later recreations. If your deployment already supplies a separate interpolation file, preserve its variables and make sure the admin hash comes from the intended file.

docker compose --env-file /secure/vaultwarden/admin.env config -q
docker compose --env-file /secure/vaultwarden/admin.env up -d --force-recreate vaultwarden

Keep plain docker compose config output and container inspection output out of shared logs. The environment-based method still exposes the value to operators with Docker inspection access. If the admin panel previously saved an admin_token in config.json, update the effective setting there through the protected admin workflow. A persisted value takes precedence over the environment. Vaultwarden admin and configuration precedence · Docker Compose interpolation

Accept the change using two fresh sessions

  1. Open /admin from the intended administrative network in a fresh browser session. Sign in with the original password.
  2. From a separate fresh session, try one incorrect value and verify that access is denied. Use no real value in your notes.
  3. If the correct password fails, check which source controls admin_token, whether Compose read the private file, and whether the service was recreated. If it only works in your old browser session, keep the result marked unverified.

If a password or hash appeared in a public commit or article, restrict admin access, rotate the password and hash, and remove the exposed copy. Changing the password does not expire existing admin sessions. Review Vaultwarden’s documented session invalidation procedure before applying it, since rotating the signing key affects sessions. The checks here are proposed, with no instance test claimed. Vaultwarden admin sessions

See the Vaultwarden Docker Compose guide for initial setup and Vaultwarden backup checks for protecting the deployment files.