DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
+2 votes

I need to translate this command for use in Arch Linux:

adduser lemmy --system --disabled-login --no-create-home --group

According to --disabled-login can be substituted for -s /usr/bin/nologin.

The equivalent of --no-create-home is the same:

-M, --no-create-home
           Do no create the user's home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes.
-r, --system
           Create a system account.
-U, --user-group
           Create a group with the same name as the user, and add the user to this group.

Would it be like this?

sudo useradd --system --shell /usr/bin/nologin --no-create-home --user-group lemmy
edited by

1 Answer

+1 vote

that command looks right - you could simply experiment to be sure, verifying the result in /etc/passwd and /etc/groups - AFAIK these commands are only helpers which manage lines in /etc/passwd, /etc/shadow, and /etc/groups, optionally cloning the $HOME dir from /etc/skel

also IIRC, even on distros which have the adduser command, it's man page suggests not using that command directly; but to use useradd instead

on an arch system, system users will be assigned a UID in the 900-1000 range, by default - login users will be assigned a UID in the >=1000 range - and the system standard users (eg: per sysusers) have very low UIDs ~ <100-ish

in /etc/passwd:

       UID  GID  GECOS
       v    v    v
^    ^            ^          ^
user pass         $HOME      shell

git:x:982:982:git daemon user:/:/sbin/nologin

dbus:x:81:81:System Message Bus:/:/sbin/nologin

'pass' is usually 'x', which indicates that the password is actually stored in /etc/shadow

the GID should correspond to a group in /etc/groups

GECOS is optional human-readable user details, such as full name and contact info, which can be specified with the --comment option

edited by
Contributions licensed under CC0