Linux · Least Privilege

Linux: Securing File Permissions

Audited and corrected file permissions on a research team's Linux directory to enforce least privilege.

Case study · Google Cybersecurity Professional CertificateBashlschmodLinux permissions
Linux: Securing File Permissions
6
items audited
3
permissions corrected
0
world-writable files left
S

Situation

A research team's project files had permissions that didn't match who should have access, including a file that any user on the system could modify.

T

Task

Check every file and directory, including hidden ones, and correct the permissions to match the organisation's authorisation policy.

A

Action

  • Listed everything with ls -la, including hidden files, and decoded each 10-character permission string.
  • Removed write access for other users with chmod o-w project_k.txt.
  • Made an archived hidden file read-only for its owner and group with chmod u-w,g-w,g+r .project_x.txt (octal 440).
  • Restricted the drafts directory to its owner with chmod g-x drafts (octal 700), and checked the result after each change.
R

Result

  • Corrected 3 items so that every permission matches policy, leaving no world-writable files.
  • Later turned this into a detection rule that alerts when someone makes files world-writable (see Detection-as-Code).

Theme Colors