Managing Users & Groups
under GNU/Linux
Serge Y. Stroobandt
Copyright 2014–2019, licensed under Creative Commons BY-NC-SA
- Home
- IT
- Command Line
- Users & Groups
List all users
List all groups
Always use adduser or addgroup
The useradd, userdel and usermod commands are lowlevel utilities which are there for historical reasons, while adduser/deluser Do The Right Thing™.
adduser and addgroup add users and groups to the system according to command line options and configuration information in /etc/adduser.conf. They are friendlier front ends to the low level tools like useradd, groupadd and usermod programs, by default choosing Debian policy conformant UID and GID values, creating a home directory with skeletal configuration, running a custom script, and other features. adduser and addgroup can be run in one of five modes:
Manpage for useradd says:
useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.
Mnemonics
Naughty mnemonics are the ones that are best remembered, so here it goes:
The word “user” rhymes with “loser”, and “loser” comes last.
Thus, it is: adduser & deluser.
Create an SSH key pair
mkdir $HOME/.ssh
chmod 600 $HOME/.ssh
ssh-keygen -t rsa -b 4096 -f $HOME/.ssh/id_rsa
ssh-add $HOME/.ssh/id_rsa
Change a user’s finger information
Delete an existing user
List a user’s group membership
The id
command offers much more information than the group names listed by groups
. UID, primary GID and other group IDs are listed as well.
Add an existing user to an existing group
Log out and in again for this group affiliation to take effect.
Delete an existing user from an existing group
This work is licensed under a Creative Commons Attribution‑NonCommercial‑ShareAlike 4.0 International License.
Other licensing available on request.
Unless otherwise stated, all originally authored software on this site is licensed under the terms of GNU GPL version 3.
This static web site has no backend database.
Hence, no personal data is collected and GDPR compliance is met.
Moreover, this domain does not set any first party cookies.
All Google ads shown on this web site are, irrespective of your location,
restricted in data processing to meet compliance with the CCPA and GDPR.
However, Google AdSense may set third party cookies for traffic analysis and
use JavaScript to obtain a unique set of browser data.
Your browser can be configured to block third party cookies.
Furthermore, installing an ad blocker like EFF's Privacy Badger
will block the JavaScript of ads.
Google's ad policies can be found here.
transcoded by to make it run as secure JavaScript in the browser.