Linux Accounts, Permissions, and Software
A practical guide to Ubuntu/Debian user and group management, file access controls, and APT software operations.
Accounts, Groups, and Administrative Access
A user account gives a person or service an identity on the system. A group lets administrators grant shared access to several users—for example, members of a project group can work with shared files without opening access to everyone. Linux also uses system accounts for services, so do not remove an account just because its name is unfamiliar.
On Ubuntu, common account tasks include:
sudo adduser sam # Create an account and set its password
sudo addgroup project # Create a group
sudo adduser sam project # Add sam to the project group
id sam # Check sam's IDs and group membership
sudo passwd -l sam # Lock password-based login
sudo deluser sam # Delete the account
The account and group changes above use sudo because they change system accounts; id checks information. On Ubuntu, membership in the sudo group grants administrative capability. Use sudo only for trusted administrative tasks, and give that membership only to people who need it.
Two distinctions matter when securing or removing an account. Locking a password does not necessarily block every sign-in method: the account might still have SSH key access. And deleting an account does not automatically delete its home directory or data. Decide separately whether to retain or remove that directory and its contents.
Ownership and File Permissions
Each file and directory has an owner and an associated group. Permissions control access for three classes: the owner (u), the group (g), and other users (o). The basic permissions are read (r), write (w), and execute (x). For a directory, execute permission allows traversal into it; it does not mean running a file.
Inspect permissions with ls -l; use ls -ld when you want to inspect a directory itself. For example, -rw-r----- gives the owner read and write, the group read, and others no access. chmod changes permissions, while chown changes ownership:
ls -l report.txt
chmod 640 report.txt
sudo chown sam:project report.txt
chmod g+rw shared-notes.txt
To interpret numeric modes, calculate one digit for each class—owner, group, then others—using r = 4, w = 2, and x = 1. In 640, the owner's 6 is 4 + 2 (read and write), the group's 4 is read, and the others' 0 grants no access. The symbolic command chmod g+rw shared-notes.txt instead adds group read and write access.
Choose the narrowest permissions that meet the task. Avoid 777, which grants everyone read, write, and execute access. Use recursive changes such as -R cautiously: they can unintentionally change every file below a directory. Commands that change permissions or ownership may require administrator privileges when elevated access is needed.
Managing Software with APT
A package manager installs software, tracks package files, and handles dependencies. On Ubuntu and Debian, APT is the standard package manager for software from repositories. Refresh its package index before installing or upgrading, so APT can use current repository information:
sudo apt update
sudo apt install package-name
sudo apt upgrade
Before confirming an operation, review APT's proposed changes—especially on a server. Prefer trusted distribution repositories and the package manager rather than downloading and running unknown installation scripts. Installing, upgrading, and removing system software require administrator privileges.
To uninstall a package, use sudo apt remove package-name. This may leave the package's system configuration files. sudo apt purge package-name also removes those configuration files, so check whether they should be preserved before purging. Neither action is the same as deleting a user's documents or other application data: package configuration and personal data are distinct.
For routine administration or troubleshooting, APT records package actions in /var/log/dpkg.log; checking that log can help establish what package actions were recorded.