debian-users-and-groups
Table of Contents
Debian users and groups
Every process on Debian runs as a user. Users have numeric identifiers (UIDs), groups have GIDs. Permissions and resource limits are assigned per-user and per-group.
Adding users
Create a user with a home directory:
useradd -m username
The interactive version (prompts for gecos, shell, etc.):
adduser username
Set password:
passwd username
Removing users
Delete user but keep home directory:
deluser username
Delete user and home:
deluser --remove-home username
Groups
Create a group:
groupadd groupname
Add user to group:
usermod -aG groupname username
The -a appends; without it, existing groups are replaced.
List groups for user:
groups username
Common groups
sudo: run commands withsudodocker: use Docker withoutsudoaudio: access audio devicesvideo: access video deviceswww-data: web server process owneradm: read log files
Listing users
cut -d: -f1 /etc/passwd
View full user info:
getent passwd username
User configuration files
/etc/passwd: user accounts (readable, no passwords)/etc/shadow: hashed passwords (root-only)/etc/group: group definitions/etc/gshadow: group passwords (rarely used)
Changes made with useradd, usermod, groupadd update these files automatically. Manual editing is possible but error-prone; use the commands instead.
debian-users-and-groups.md · Last modified: by 127.0.0.1
