Source: https://superuser.com/questions/77617/how-can-i-create-a-non-login-user
Create new user
adduser --system --no-create-home --group --disabled-login $USER
- Create a user with a UID in the “system” range (not much different otherwise)
- No home directory
- Create a group for the user (same name)
- Prevent the user from logging in normally (can switch from root though)
Create Group
addgroup --gid 2000 $GROUP
- Can manually set the group ID with
--gid
Add existing user to another group
usermod -aG $GROUP $USER
-a
ensures the group is appended to the user’s list of groups instead of replacing it.