How to Change File Permissions in Ubuntu

The File Permission Matrix Override Vector

The Ubuntu Linux architecture enforces a mathematically rigid, three-tiered permission model on every single file and directory. Each inode on the physical solid-state drive possesses three distinct permission sets: Owner (the user who created it), Group (users sharing a common group ID), and Others (everyone else on the system). Each set defines three binary flags: Read (r), Write (w), and Execute (x). If a critical bash script (.sh) refuses to run, throwing a stark “Permission denied” error, it means the execute flag (x) is mathematically absent for your user profile. You must instruct the core UNIX kernel to override the permission matrix using the chmod (Change Mode) binary.

How to Change File Permissions in Ubuntu

The Linux command-line architecture supports two mathematically distinct syntaxes for chmod: the human-readable symbolic mode and the God-level octal (numeric) mode.

1. Open your terminal application or connect to the headless server via SSH.
2. Method 1: The Symbolic Mode (The Human-Readable Vector):
* This pathway uses letters to define the target (u=owner, g=group, o=others, a=all) and the operation (+=add, -=remove, ==set exactly).
* Example 1 (Grant execute permission to the owner):
chmod u+x script.sh
* Example 2 (Remove write permission from others):
chmod o-w config.txt
* Example 3 (Grant read and write to everyone):
chmod a+rw data.csv
* Press Enter after each command. The execution is silent; no output means success.
3. Method 2: The Octal Mode (The God-Level Numeric Vector):
* This pathway uses a three-digit integer. Each digit (0-7) represents the sum of permission values: Read=4, Write=2, Execute=1.
* Common Combinations:
* 755 = Owner: rwx (7), Group: r-x (5), Others: r-x (5). Standard for executable scripts and web directories.
* 644 = Owner: rw- (6), Group: r– (4), Others: r– (4). Standard for static files like .html or .conf.
* 700 = Owner: rwx (7), Group: — (0), Others: — (0). Maximum lockdown; only the owner can touch it.
* Syntax: chmod [octal] [filename]
* Type exactly: chmod 755 deploy.sh
* Press Enter.
4. Method 3: The Recursive Override (The Directory Vector):
* To apply permissions to a folder and every single nested file and sub-directory inside it.
* Type exactly: chmod -R 755 /var/www/html/
* The -R flag forces the kernel to recursively descend through the entire directory tree.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.