What Does chmod 755 (rwxr-xr-x) Mean in Linux & Unix File Systems?
In POSIX-compliant operating systems including Linux, macOS, and FreeBSD, octal mode 755 (symbolic representation rwxr-xr-x for executable scripts or drwxr-xr-x for directories) is the standard permission mask for public web server directories, executable shell scripts, and system binaries in /usr/local/bin. Each octal digit is the bitwise sum of Read (4), Write (2), and Execute (1).
For chmod 755, the file owner receives full control (4 + 2 + 1 = 7, rwx), while both the assigned group and all other local system users receive read and execute permissions without write access (4 + 0 + 1 = 5, r-x). On Linux directories, the execute bit (x) grants traversal permission—allowing Nginx, Apache, or Caddy worker processes to cd into the directory and resolve child inodes—while preventing unprivileged processes from creating, renaming, or deleting files inside that directory.
- Owner Bitmask 7 (4 Read + 2 Write + 1 Execute = rwx): The deploying user or service account can read, modify, rename, and execute the file or list and modify directory entries.
- Group Bitmask 5 (4 Read + 0 Write + 1 Execute = r-x): Members of the file group (such as www-data or nginx) can read file contents and traverse directories or run scripts, but cannot overwrite them.
- Public/Others Bitmask 5 (4 Read + 0 Write + 1 Execute = r-x): Unauthenticated system processes can read and traverse public assets without gaining write privileges.
Applying chmod 755 Safely to Web Roots without Breaking Static Files
A common mistake when deploying Nginx or Apache document roots (/var/www/html) is running chmod -R 755 across the entire tree, which accidentally marks static HTML, CSS, JSON, and image files as executable scripts. Best-practice production hardening applies chmod 755 strictly to directories (find /var/www/html -type d -exec chmod 755 {} +) while keeping regular files at chmod 644 (find /var/www/html -type f -exec chmod 644 {} +).
Practical Real-World Use Cases
System administrators and DevOps engineers apply chmod 755 across standard Linux deployment and container workflows:
- Nginx, Apache & Caddy Public Document Roots (/var/www/html): Grant directory traversal (r-x) to unprivileged worker processes (www-data) while keeping write access restricted exclusively to the deploy user.
- Docker Entrypoint Scripts & CI/CD Shell Hooks: Run chmod 755 docker-entrypoint.sh or git update-index --chmod=+x before building OCI container images so Kubernetes pods do not crash with "exec format / permission denied".
- Shared CLI Binaries in /usr/local/bin: Install root-owned CLI tools (kubectl, terraform, node) with mode 0755 so every local developer account can invoke the binary without sudo.
Frequently Asked Questions
What is the difference between chmod 755 and chmod 644 on Linux?
chmod 755 (rwxr-xr-x) adds the execute bit (1) for owner, group, and public, making it required for directories (so users can traverse them) and executable scripts/binaries. chmod 644 (rw-r--r--) omits the execute bit, making it the standard permission for non-executable static files like HTML, CSS, images, and configuration files.
How do I recursively set directories to chmod 755 without making files executable?
Run find /path/to/dir -type d -exec chmod 755 {} + to apply 755 only to directories, followed by find /path/to/dir -type f -exec chmod 644 {} + for regular files.