Users Management

Utilities

adduser, addgroup – add a user or group to the system

--gecos GECOSSet the gecos field for the new entry generated. adduser will not ask for finger information if this option is given.
--systemCreate a system user or group.
--shell SHELLUse SHELL as the user’s login shell, rather than the default specified by the configuration file.
--no-create-homeDo not create the home directory, even if it doesn’t exist.
--quietSuppress informational messages, only show warnings and errors.
adduser --system --no-create-home proxmoxbackup
adduser --no-create-home --shell /usr/sbin/nologin proxmoxbackup
adduser --disabled-password --gecos "" username

deluser, delgroup – remove a user or group from the system

--systemOnly delete if user/group is a system user/group.
--remove-homeRemove the home directory of the user and its mailspool.
--remove-all-filesRemove all files from the system owned by this user.
deluser --system --remove-home proxmoxbackup

usermod – modify a user account

-a, --appendAdd the user to the supplementary group(s). Use only with the -G option.
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace.

Add current user to the nut group (works after logoff):

usermod -aG nut `whoami`

gpasswd – administer /etc/group and /etc/gshadow

-a, –add userAdd the user to the named group.
-d, –delete userRemove the user from the named group.

Add a user to a group:

gpasswd -a $USER timekpr

pgrep, pkill, pidwait – look up, signal, or wait for processes based on name and other attributes

Unlog a user

pkill -U leopardb

id – print real and effective user and group IDs

who – show who is logged on

Random

List local users or groups

getent passwd
getent group

useradd,adduser