First Login and Setup
The outcome of this chapter is an administrator account that is yours — not a default, not a shared secret — and a login you have proven works. A fresh NPM has no users at all: there is no factory password to look up and change. Instead, the first visit runs a setup flow that creates the first administrator, and that flow closes the moment one exists. (Older versions of NPM shipped a default login; v2.16.0, the release this guide's lab ran, does not — the lab proved it by trying the old default and being refused, transcript t05.)
The interactive way. Open
http://<your-machine>:81. On a fresh
install the interface shows the setup
screen instead of a login form. Give
a name, a nickname, your email
address, and a password — used here in
two senses: the email is your login
identity, and you can use a local,
invented one for a home install,
because NPM does not mail you anything
to create the account. The account is
created with the admin role and
full permissions over every host type
(chapter 11 unpacks those words). You
are then asked to log in with the
password you just set.
Behind the screen, the lab watched
this happen through the API
(transcript t06): creating the user
returned the new account with
"roles":["admin"], the backend's
health line flipped from
"setup":false to "setup":true,
and logging in returned a signed
token — the file your browser
holds instead of your password for the
rest of the session.
The automated way. If the
environment variables
INITIAL_ADMIN_EMAIL and
INITIAL_ADMIN_PASSWORD are set when
a user-less NPM first starts, it
creates that administrator itself and
skips the wizard. This exists for
people who deploy with scripts. The
trade is worth seeing plainly: the
password passes through your Compose
file or deployment tooling, where
passwords tend to be kept, shared and
forgotten. For an interactive home
install, the wizard keeps the secret
in exactly one place — the database,
hashed with bcrypt — and this guide
recommends it.
Immediately, before your first host: give this account its master-key treatment from chapter 1. Set two-factor authentication from the user menu (chapter 11 shows where it lives), and decide now who else, if anyone, gets a login — extra users with limited permissions beat a shared admin password every time.
The check: log out and log back
in. Then, if you have shell access to
the machine, look at the ground truth
the lab used: the file
./data/database.sqlite exists and
has grown beyond an empty skeleton,
and ./data/keys.json exists beside
it — the database that remembers your
account, and the keys that sign its
tokens. Both live in the folder
chapter 3 told you to back up; now
you know why they are the crown
jewels of that backup.