dnz login and the
session is saved for later commands. In scripts, use an API token instead.
Signing in
dnz login asks for your username and password. If someone else set your password (a new account, or
an admin reset it), dnz login asks you for a new one right away.
Where the session is saved
The session is saved in~/.config/dnz/credentials.toml, readable only by you. If
XDG_CONFIG_HOME is set, it goes to $XDG_CONFIG_HOME/dnz/credentials.toml instead, and
DNZ_CREDENTIALS points it at any file you choose.
The last server you signed in to becomes the default. Pick another one with --server or
DNZ_SERVER.
Which server a command talks to
--serverDNZ_SERVER- the last server you signed in to
- this machine’s
http.addrfrom the config file
API tokens for scripts
For cron jobs, CI and other scripts, use an API token instead of a session. Pass it with--token dnz_… or the DNZ_TOKEN environment variable:
dnz token create; the token is printed once, on its own line, so a script
can capture it:
Passwords without a terminal
When there is no terminal to type a password in, the CLI reads it from the environment:Servers with a private CA
If the server is onhttps:// with a certificate from a private CA (step-ca, an internal PKI), pass
the CA certificates as a PEM bundle with --ca-cert (or DNZ_CA_CERT) when you sign in:
Sessions
You can be signed in from several places: the dashboard in a browser, the CLI on your laptop, the CLI on the server. List them and sign out the ones you don’t need:DNZ_SESSION_TTL_HOURS and DNZ_SESSION_IDLE_HOURS change that (see
Configuration).
Troubleshooting
Not signed in: run dnz login
Not signed in: run dnz login
There is no saved session for that server. Check which server the command picked (the order is
above), then sign in to it, or pass
--token.A command works in the shell but not in cron
A command works in the shell but not in cron
Cron has no terminal: pass
--yes to commands that delete or replace something, and give
passwords through DNZ_PASSWORD / DNZ_NEW_PASSWORD, or better, use an API token. Also check
that cron runs as the same user, since the credentials file is per user (or set
DNZ_CREDENTIALS).Certificate errors on an https:// server
Certificate errors on an https:// server
The server’s certificate comes from a CA your machine doesn’t trust. Sign in again with
--ca-cert pointing at the CA bundle.