Hi,
I want to install nixos without a root password. Obviously, I should use nixos-install --no-root-passwd
.
But could it be a problem for creating a user after, as it is explained is the documentation ?
You should log in and change the root password with passwd.
$ useradd -c 'Eelco Dolstra' -m eelco
$ passwd eelco
So : how to create a user account without root ?
misuzu
January 1, 2024, 8:57pm
2
There’s an example user account in the generated configuration.nix, just uncomment it and change username to yours. After installation run this: nixos-enter --root /mnt -c 'passwd myusername'
.
Do not use useradd
to add users.
1 Like
Thanks for your answer.
So, if I follow correctly, for the installation procedure :
uncomment user account in configuration.nix
and create the one associated to myusername
do nixos-install --no-root-passwd
do nixos-enter --root /mnt -c 'passwd myusername'
reboot
login with myusername
and passwd
Is that right ?
If it is not the proper way to do it, why letting this in the manual/documentation ?
misuzu
January 2, 2024, 8:06am
4
Between quotes ? : nixos-enter --root /mnt -c 'passwd myusername'
nixos-enter --root /mnt -c passwd myusername
instead ?
misuzu
January 2, 2024, 8:14am
6
nixos-enter --root /mnt -c 'passwd myusername'
is correct, replace myusername
with your username in configuration.nix