Referencing the answers to this question, they give nifty one-liners to create such a user such as:
sudo adduser --system --no-create-home --group mightydog
After this, can user mightydog
log on? What is his password?
Referencing the answers to this question, they give nifty one-liners to create such a user such as:
sudo adduser --system --no-create-home --group mightydog
After this, can user mightydog
log on? What is his password?
There's no harm in simply trying it out. On my system (16.04), this resulted in a user with locked password (*
) and no valid login shell (/bin/false
), as can be seen from its /etc/passwd
and /etc/shadow
entry:
# grep mightydog /etc/passwd
mightydog:x:128:138::/home/mightydog:/bin/false
# grep mightydog /etc/shadow
mightydog:*:17610:0:99999:7:::
So no, it does not have a password, and it also can not log in by any other means (like SSH keys, or using sudo -u
) due to the /bin/false
shell.
/bin/bash
and you should be able to log in using sudo -u
or SSH after setting up key-based authentication.
– Byte Commander
Mar 20 '18 at 14:31
adduser
manpage under Add a system user
: "The new system user will have the shell /bin/false (unless overridden with the --shell option), and have logins disabled."
– steeldriver
Mar 20 '18 at 15:05