chmod
Change file mode bits. Used to control who can read, write, or execute a file.
Synopsis
chmod [options] mode file(s)
Core Options
-RChange files and directories recursively.
uUser (owner) permissions.
gGroup permissions.
oOthers permissions.
aAll users (u, g, and o).
Usage Examples
Make Executable
Allow the owner to execute the file.
chmod u+x script.shStandard Web Permissions
Files 644 (rw-r--r--), Directories 755 (rwxr-xr-x).
chmod 644 index.htmlFull Permissions (Dangerous)
Give everyone read, write, and execute permissions.
chmod 777 data/Remove Write Permission
Prevent group and others from writing.
chmod go-w file.txtRecursive Change
Change permissions for a directory and everything inside it.
chmod -R 755 /var/www/htmlBuilt for builders.