← Users & Permissions
Linux · Users & Permissions
How to change file permissions in Linux
Change file permissions with chmod using octal and symbolic modes, including recursive changes done safely.
Change a file permissions with chmod, in octal (755) or symbolic (u+x) form. Run as the owner or root.
chmod -R on the wrong path can break access across the system, and 777 makes a file world-writable, so avoid it. Set the least permission that works.
# Octal: owner rwx, group and other r-x
chmod 755 <file>
# Common file mode: owner rw, others r
chmod 644 <file>
# Symbolic: add execute for the owner
chmod u+x <file>
# Remove write from group and other
chmod go-w <file>
# Recursively (check the path first)
sudo chmod -R 750 /opt/app
# Verify
ls -l <file>LinuxchmodPermissions