# 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: ```bash useradd -m username ``` The interactive version (prompts for gecos, shell, etc.): ```bash adduser username ``` Set password: ```bash passwd username ``` ## Removing Users Delete user but keep home directory: ```bash deluser username ``` Delete user and home: ```bash deluser --remove-home username ``` ## Groups Create a group: ```bash groupadd groupname ``` Add user to group: ```bash usermod -aG groupname username ``` The `-a` appends; without it, existing groups are replaced. List groups for user: ```bash groups username ``` ## Common Groups - `sudo` — run commands with `sudo` - `docker` — use Docker without `sudo` - `audio` — access audio devices - `video` — access video devices - `www-data` — web server process owner - `adm` — read log files ## Listing Users ```bash cut -d: -f1 /etc/passwd ``` View full user info: ```bash 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.