Online Linux Terminal Logo
OnlineLinuxTerminal
← All Tutorials•Intermediate

Linux Permissions & Chmod Security

Linux protects files using a 3-tier permission model (User, Group, Others) with Read (4), Write (2), and Execute (1) bits. Understand octal modes like 755 and 644.

Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Lesson Objectives

4 Steps
1Step 1: Inspect Current File Permissions

Run `ls -l /var/log/auth.log` and note the permission string (e.g., `-rw-r--r--`).

2Step 2: Grant Executable Permissions to Script

Run `chmod 755 /home/user/projects/demo.sh` to give owner full access and others read/execute.

3Step 3: Restrict Sensitive Private Keys

Run `chmod 600 welcome.txt` to restrict read/write access strictly to the owner.

4Step 4: Verify Updated Permission Bits

Run `ls -l welcome.txt` to confirm the permissions now display as `-rw-------`.

💡 Pro Tip:

Avoid using `chmod 777` in production servers as it grants world-writable permissions, introducing severe security vulnerabilities.

bash — terminal