userpass is a simple, built-in Vault authentication method for human users, and it is ideal for labs and small-scale use.
This article covers the minimal setup, the authentication flow, policy assignment, operational basics, comparisons with other methods, and the exam pitfalls you should know.
userpass is an auth method that lets users log in to Vault with a username and password and receive a token. It does not require an external IdP, which makes it perfect for quickly validating a standalone Vault.
For enterprise-scale operations, however, SSO integration (OIDC and friends) or machine authentication (AppRole, Kubernetes, etc.) is recommended. Treating userpass strictly as a learning, small-scale, or temporary tool is the realistic stance.
We assume Vault is already initialized and unsealed and that you have an admin token. For the CLI, make sure VAULT_ADDR and VAULT_TOKEN are set properly.
Enable userpass, create a user, assign a policy, and you can log in immediately.
Enabling and creating a user (CLI and HTTP API)
## Enable (CLI)
$ vault auth enable userpass
## Create a user (CLI)
$ vault write auth/userpass/users/alice \
password="s3cr3t!" \
policies="default,dev"
## Log in (CLI)
$ vault login -method=userpass username=alice password="s3cr3t!"
## Enable (HTTP API)
$ curl -sS \
--header "X-Vault-Token: $VAULT_TOKEN" \
--request POST \
$VAULT_ADDR/v1/sys/auth/userpass \
--data '{"type":"userpass"}'
## Create a user (HTTP API)
$ curl -sS \
--header "X-Vault-Token: $VAULT_TOKEN" \
--request POST \
$VAULT_ADDR/v1/auth/userpass/users/alice \
--data '{"password":"s3cr3t!","policies":"default,dev"}'A userpass login sends the password to /v1/auth/userpass/login/:username. The client stores auth.client_token from the response and uses it for subsequent requests. The token's TTL follows Vault's configuration.
You can tune the default TTL and max TTL of tokens issued per auth method. Use vault auth tune with -token_ttl and -token_max_ttl.
userpass authentication flow (conceptual)
Inspecting tokens and tuning TTL
## Inspect token attributes
$ vault token lookup
## Tune TTL for tokens issued by userpass (e.g. default 1h, max 4h)
$ vault auth tune -token_ttl=1h -token_max_ttl=4h userpass/
## Renew a token (when renewable)
$ vault token renewGive userpass users their access boundaries through ACL policies. For personal study or team validation, scope reads explicitly and keep writes tightly limited.
Policy updates take effect on the next token that is issued. To apply them to an existing token immediately, revoke that token and have the user log in again.
Sample policy and applying it to a user
# dev.hcl (example: KV v2 read with limited write)
path "secret/data/dev/*" {
capabilities = ["create", "update", "read", "list"]
}
path "secret/metadata/dev/*" {
capabilities = ["list", "read"]
}
# Register the policy
$ vault policy write dev dev.hcl
# Create/update a user with the policy
$ vault write auth/userpass/users/alice \
password="rotate-2026-04" \
policies="default,dev"The operational priorities are the same even at small scale: do not leave unused accounts or tokens behind, rotate passwords regularly, and watch the audit log.
Disabling an auth method invalidates every token that method has issued. Plan the change deliberately.
Common operational commands
## Change a password
$ vault write auth/userpass/users/alice password="new-P@ss-2026"
## List users
$ vault list auth/userpass/users
## Delete a user
$ vault delete auth/userpass/users/alice
## Revoke a token (force logout)
$ vault token revoke <token>
## Disable the auth method (high impact — plan it)
$ vault auth disable userpass/For learning and small-scale use, userpass wins on simplicity. For organizational use, OIDC-based SSO is the realistic choice, and for machine workloads it is AppRole or Kubernetes Auth.
For exam prep, what matters is being able to articulate each method's primary purpose, human-vs-machine fit, and setup cost.
| Method | Primary use case | Scale fit | Human / Machine |
|---|---|---|---|
| userpass | Human login for labs and PoCs | Small | Human |
| GitHub | Developer auth for a GitHub organization | Small to mid | Human |
| OIDC | Integrated with enterprise SSO | Mid to large | Human |
| AppRole | Machine auth for CI/CD, batch jobs, etc. | Small to large | Machine |
At the Associate level, expect questions on the basics: enabling userpass, creating users, the login flow, assigning policies, and tuning token TTL. Knowing both the CLI and HTTP API paths will pay off.
Watch out for TTL vs. lease confusion. Auth methods issue tokens, and tune targets token_ttl / token_max_ttl. Secrets engines, on the other hand, tune default and max lease TTL.
Snippets worth memorizing
# Enable and tune TTL (summary)
$ vault auth enable userpass
$ vault auth tune -token_ttl=1h -token_max_ttl=4h userpass/
# Create, log in, verify
$ vault write auth/userpass/users/alice password="p" policies="dev"
$ vault login -method=userpass username=alice password="p"
$ vault token lookupAssociate
問題 1
In a lab environment, three developers need to log in to Vault and test with the smallest possible setup and operational cost. Which approach is best?
正解: A
For learning and small-scale use, userpass is the fastest safe starting point. AppRole is meant for machines, OIDC has high upfront cost, and distributing the root token is not acceptable.
Can Vault enforce password complexity or expiration for userpass?
userpass itself does not enforce password policies. Manage complexity and rotation through your organizational rules, manual processes, or external systems. Consider OIDC or another IdP integration when stronger controls are required.
I changed a user's policies but the permissions are not taking effect.
Already-issued tokens do not pick up the new policy. To apply the new permissions, revoke the affected token and have the user log in again, or wait for the token to expire and be reissued.
Where do I tune the TTL of tokens issued by userpass?
Tune it per auth method. Run vault auth tune with -token_ttl and -token_max_ttl against userpass/.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...