Change Permissions - chmod
Modify file permissions using numeric mode.
chmod 755 file.txtCommon permission numbers:
777 - rwxrwxrwx (read, write, execute for all)
755 - rwxr-xr-x (owner full, others read+execute)
644 - rw-r--r-- (owner read+write, others read)
600 - rw------- (owner read+write only)Symbolic notation add permissions:
chmod u+x file.txt # Add execute for owner
chmod g+w file.txt # Add write for group
chmod o+r file.txt # Add read for others
chmod a+x file.txt # Add execute for allRemove permissions:
chmod u-w file.txt
chmod go-rwx file.txtRecursive chmod:
chmod -R 755 directory/
Change Owner - chown
Change file owner and group.
chown user file.txtChange owner and group:
chown user:group file.txtChange group only:
chown :group file.txtRecursive:
chown -R user:group directory/
View Permissions
Display file permissions and ownership.
ls -l file.txtOutput format: -rwxr-xr-x owner group
Permission Symbols
Understanding permission notation:
r = read (4)
w = write (2)
x = execute (1)
First character: file type (- = file, d = directory, l = link)
Next 3: owner permissions (rwx)
Next 3: group permissions (r-x)
Last 3: others permissions (r-x)
Umask
Set default permissions for new files.
umaskSet umask value:
umask 022Common umask values:
022 - New files: 644, directories: 755
027 - New files: 640, directories: 750
077 - New files: 600, directories: 700
Special Permissions
Setuid bit (run as owner):
chmod u+s file
chmod 4755 fileSetgid bit (inherit group):
chmod g+s directory
chmod 2755 directorySticky bit (only owner can delete):
chmod +t directory
chmod 1777 directory
Access Control Lists
View ACL permissions.
getfacl file.txtSet ACL permissions:
setfacl -m u:username:rwx file.txt
Common mistakes / Pitfalls
- People often copy a command or pattern without adapting placeholders, which can break production workflows unexpectedly.
- It is easy to forget environment-specific differences, so always verify behavior in your shell, runtime, or API gateway before shipping.
- Many errors come from skipping small validation steps, so test with realistic sample input before relying on the result.
Last updated: February 2026