Permissions
Special Bits
setuid
and setgid
replace the execute bit with s/S on owner/group;sticky
replaces others' execute with t/T.
Custom Octal
Common Presets
What this means
Owner can read/write, others read-only — standard for text files, configs, and web content where only the owner edits.
Output
644
0644
-rw-r--r--
u=rw,g=r,o=r
Example Commands
chmod 0644 file.txt
chmod u=rw,g=r,o=r file.txt
Output Options
How this was calculated
Single Permission chmod Generator
This tool allows you to generate a chmod command for a single permission change.
This means that all other permissions will remain unchanged. So you can easily modify/add/remove one permission for a given user type.
Class
Operator
Permission
What is chmod?
File permissions in Linux control who can read, write/edit and execute any given file. The chmod command is used to set these permissions.
These file permissions are a core feature of Linux and UNIX-like systems. They prevent unauthorized access or modifications of files, safeguard users from accidental changes, and ensure that only the right users can execute programs.
To set or update permissions, we use the `chmod` command. In the format of `chmod [permissions] [file/directory]`. The permissions can either be expressed in octal digits (like 755) or symbolic form (like u=rwx,g=rx,o=rx). The chmod combination is always specified in the order of (1) user, (2) group and (3) others/public.
Common Examples
chmod 600 ~/.ssh/id_rsa
Owner read/write; private files like SSH keyschmod 644 /var/www/html/index.html
Owner read/write; everyone else read; typical text fileschmod 700 /home/user/private_script.sh
Owner full control; private scripts or directorieschmod 755 /usr/local/bin/my_script.sh
Owner and group users have full access, all other users can only read and runchmod 775 /shared/project
Everyone can read and execute, but only the owner can write; good for shared directories
Viewing File Permissions
To view the current permissions of a file or directory, you can use the ls -l
command.
This will display the permissions in a human-readable format, showing the user, group, and other permissions. For example:
ls -l [file-name]
Core Concepts
Octal basics
Symbolic form
Special bits
Cheat Sheet
Example #1 - Symbolic Form
This command will give read, write and execute permissions to the owner, and read and execute (but not write) to users in the group, and all other users
chmod -rwxr-xr-x ./file.txt

Example #2 - Octal Denotion
This command will give read, write and execute permissions to the owner, and read and execute (but not write) to users in the group, and all other users
chmod 755 ./file.txt


Example #3 - Updating a single permission
This command will remove write permissions for the group, but leave read and execute permissions intact. The owner and others will not be affected.
chmod g-w ./file.txt

Example #4 - Updating a single permission
Give the owner execute permission, while leaving read and write permissions intact. The group and others will not be affected. Below is the full list of options
chmod u+x ./file.txt

Example #5 - Common Preset Quick Reference
This will make a file readable and writable by the owner, and just readable for the group and others. Remember, the first digit is user, second is group, third is others. So you can use the quick reference below to build your own permissions.
chmod 644 ./file.txt
