Skip to content

Linux Security - Wyatt's Notes

Linux security is fundamentally built on the user and group model. Every process runs under a Specific UID (user ID) and GID (group ID), and every file and resource is owned by a UID/GID with Associated permissions.

FilePurpose
/etc/passwdUser accounts (UID, home dir, shell — password in shadow)
/etc/shadowPassword hashes and aging (readable by root only)
/etc/groupGroup definitions (GID, members)
/etc/gshadowGroup password hashes (readable by root only)
/etc/skel/Template directory for new user home directories
/etc/login.defsDefault settings for user creation (UID range, password policy)
Terminal window
## View user information
id # current user"s UID, GID, groups
id username # specific user
finger username # detailed user info
getent passwd username # from NSS (includes LDAP, etc.)
getent group groupname
## Create user
useradd -m -s /bin/bash -G sudo,docker username # create with home, shell, groups
passwd username # set password
# Modify user
usermod -aG docker username # add to supplementary group (-a is critical!)
usermod -s /bin/zsh username # change shell
usermod -d /new/home username # change home directory
usermod -e 2025-12-31 username # set account expiration
# Delete user
userdel username # delete user, keep home
userdel -r username # delete user and home directory
# Lock/unlock account
passwd -l username # lock (prefix password hash with !)
passwd -u username # unlock
usermod -L username # lock (more reliable method)
usermod -U username # unlock
# Password aging
chage -l username # view aging info
chage -M 90 username # max password age: 90 days
chage -W 14 username # warn 14 days before expiration
chage -E 2025-12-31 username # account expires

Processes are programs in execution, each with its own memory space and priority. Systemd manages the lifecycle of services, starting them at boot and restarting them if they fail. Understanding process states (running, sleeping, stopped, zombie) helps you diagnose why a service is not responding. Signals like SIGTERM and SIGKILL provide graceful and forceful ways to control processes.