Skip to main content

chmod Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for changing file and directory permissions with chmod in Linux

chmod changes file and directory permissions in Linux. This cheatsheet covers symbolic and numeric modes, recursive updates, common permission patterns, and safety tips.

Basic Syntax

Use these core command forms for chmod.

CommandDescription
chmod MODE FILEGeneral chmod syntax
chmod 644 file.txtSet numeric permissions
chmod u+x script.shAdd execute for owner
chmod g-w file.txtRemove write for group
chmod o=r file.txtSet others to read-only

Numeric Modes

Common numeric permission combinations.

ModeMeaning
600Owner read/write
644Owner read/write, group+others read
640Owner read/write, group read
700Owner full access only
755Owner full access, group+others read/execute
775Owner+group full access, others read/execute
444Read-only for everyone

Symbolic Modes

Change specific permissions without replacing all bits.

CommandDescription
chmod u+x fileAdd execute for owner
chmod g-w fileRemove write for group
chmod o-rwx fileRemove all permissions for others
chmod ug+rw fileAdd read/write for owner and group
chmod a+r fileAdd read for all users
chmod a-x fileRemove execute for all users

Files and Directories

Typical permission patterns for files and directories.

CommandDescription
chmod 644 file.txtStandard file permissions
chmod 755 dir/Standard executable directory permissions
chmod u=rw,go=r file.txtSymbolic equivalent of 644
chmod u=rwx,go=rx dir/Symbolic equivalent of 755
chmod +x script.shMake script executable

Recursive Changes

Apply permission updates to directory trees.

CommandDescription
chmod -R 755 project/Recursively set mode for all entries
chmod -R u+rwX project/Add read/write and smart execute recursively
find project -type f -exec chmod 644 {} +Set files to 644
find project -type d -exec chmod 755 {} +Set directories to 755
chmod -R g-w shared/Remove group write recursively

Special Bits

Setuid, setgid, and sticky bit examples.

CommandDescription
chmod 4755 /usr/local/bin/toolSetuid on executable
chmod 2755 /srv/sharedSetgid on directory
chmod 1777 /tmp/mytmpSticky bit on world-writable directory
chmod u+s fileAdd setuid (symbolic)
chmod g+s dirAdd setgid (symbolic)
chmod +t dirAdd sticky bit (symbolic)

Safe Patterns

Use these patterns to avoid unsafe permission changes.

CommandDescription
chmod 600 ~/.ssh/id_ed25519Secure SSH private key
chmod 700 ~/.sshSecure SSH directory
chmod 644 ~/.ssh/id_ed25519.pubPublic key permissions
chmod 750 /var/www/appLimit web root access
chmod 755 script.shSafer than 777 for scripts

Common Errors

Quick checks when permission changes do not work.

IssueCheck
Operation not permittedCheck file ownership with ls -l and apply with the correct user or sudo
Permission still denied after chmodParent directory may block access; check directory execute (x) bit
Cannot chmod symlink target as expectedchmod applies to target file, not link metadata
Recursive mode broke app filesReset with separate file/dir modes using find ... -type f/-type d
Changes revert on mounted shareFilesystem mount options/ACL may override mode bits

Use these guides for full permission and ownership workflows.

GuideDescription
How to Change File Permissions in Linux (chmod command)Full chmod guide with examples
Chmod Recursive: Change File Permissions Recursively in LinuxRecursive permission strategies
What Does chmod 777 MeanSecurity impact of 777
Chown Command in Linux (File Ownership)Change file and directory ownership
Umask Command in LinuxDefault permissions for new files
Understanding Linux File PermissionsPermission model explained