Hashicorp Vault - Login to the vault using the vault login command
by
Jeremy Canfield |
Updated: April 01 2024
| Hashicorp Vault articles
This assumes the following has already been done.
- Hashicorp Vault has been installed
- Hashicorp Vault has been initialized
- Hashicorp Vault has been unsealed
When starting the vault, the initial root token will be displayed, like this.
Initial Root Token: s.gYGVHcHMiGsCZdKAJzWq1Yj1
The vault login command can be used to log into the vault. The token can be used to log into the vault.
vault login s.gYGVHcHMiGsCZdKAJzWq1Yj1
If you installed the vault CLI on a system different from the system that Hashicorp Vault was installed on, include the -address option where address will be something like http://vault.example.com:8200.
vault login -address <address> s.gYGVHcHMiGsCZdKAJzWq1Yj1
Or by exporting the VAULT_ADDR variable.
export VAULT_ADDR=https://vault.example.com:8201
And the following should be displayed.
Success! You are now authenticated. The token information displayed below
is already stored in the token helper. You do NOT need to run "vault login"
again. Future Vault requests will automatically use this token.
Key Value
--- -----
token s.gYGVHcHMiGsCZdKAJzWq1Yj1
token_accessor Z0Q8To48Rkkgx7zka-dqsDjJ
token_duration ∞
token_renewable false
token_policies ["root"]
identity_policies []
policies ["root"]
And the vault auth list command should return something like this.
~]$ vault auth list
Path Type Accessor Description Version
---- ---- -------- ----------- -------
token/ token auth_token_5013c38c token based credentials n/a
Did you find this article helpful?
If so, consider buying me a coffee over at