Unable to log in after adding new user to users.users

Hello, this has actually happened to me many times on multiple machines but it’s finally bugged me enough to ask.

If I add a user to users.users in configuration.nix that wasn’t there upon installation, and rebuild switch, add a password for that user with passwd, then reboot and try to log in, the user info appears but I can no longer log in to any of the users… Why does this happen?

So, adding the password = "<password>"; attribute seems to fix it… Not sure why it fails to log in any of the users if only one of them does not have this field set. After logging in with this, I’m able to change the password with passwd and log in again without issue, however, adding a user without this and then trying to add a password with passwd doesn’t seem to solve the problem.

Do you have mutableUsers enabled?

I do not, but adding the password field, rebooting and then changing the password seems to have fixed it for me.