Online Linux Terminal Logo
OnlineLinuxTerminal
Permissions & SecurityCLI Reference

$chmod

Change file access permission mode bits for owner, group, and other users.

Syntax DefinitionPOSIX standard
chmod [OPTIONS] MODE[,MODE]... FILE...
Linux Community2.4k Online

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

Try `chmod` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

Overview & How chmod Works

`chmod` (Change Mode) manages file and directory permissions in Linux. Every file has read (`r=4`), write (`w=2`), and execute (`x=1`) permissions for three classes: User (Owner), Group, and Others. Permissions can be set using 3-digit octal notation (e.g., `755` or `644`) or symbolic notation (e.g., `u+x`, `g-w`, `o=r`).

Common Flags & Command Options

Flag / OptionDescription
755rwxr-xr-x: Owner has full control; group and others can read and execute.
644rw-r--r--: Owner can read and write; group and others can read only.
700rwx------: Owner has full control; no access for anyone else.
-RRecursively change file permissions on all subdirectories and files.
+xMake a script or binary file executable for all users.

Practical Real-World Examples

Example #1Make a bash script executable
chmod +x /home/user/projects/demo.sh && ls -l /home/user/projects/demo.sh

Adds execute permissions to demo.sh and verifies the updated mode bits.

Sample Output:
-rwxr-xr-x 1 user user 180 Aug 28 12:10 demo.sh
Example #2Set standard web file permissions (644)
chmod 644 /var/log/syslog

Grants read/write to owner and read-only to group and others.

Common Errors & Troubleshooting

chmod: changing permissions of ...: Operation not permitted
Cause: You do not own the file and lack root privileges.
Solution: Use `sudo chmod 755 [file]` or switch to the file owner account.

Frequently Asked Questions

What do the numbers in chmod 755 represent?

Each digit represents permissions for Owner, Group, and Others. 7 is 4(read)+2(write)+1(execute), while 5 is 4(read)+1(execute).