Chmod Calculator (rwx / 0755)

Toggle permissions or enter an octal value (e.g. 755 or 0644).

Owner


Group


Others



How Unix File Permissions (chmod) Work

Unix and Linux systems control access to files and directories using three permission classes: Owner (the user who owns the file), Group (users belonging to the file's primary group), and Other (everyone else on the system). Each class has three basic permissions: Read (r = 4), Write (w = 2), and Execute (x = 1). Adding the numeric values for each class produces the familiar three-digit octal notation such as 755 or 644.

Understanding Octal vs. Symbolic Notation

In octal mode, each digit is the sum of its enabled bits: 4 + 2 + 1 = 7 (rwx), 4 + 0 + 1 = 5 (r-x), and 4 + 0 + 0 = 4 (r--). In symbolic ls -l output, the same permissions appear as a nine-character string like -rwxr-xr-x (with a leading - for regular files or d for directories). When you toggle any checkbox in the calculator above, both the octal value and the symbolic string update immediately.

Special Bits: Setuid, Setgid, and Sticky Bit

A four-digit octal mode such as 0755 or 1777 includes a leading digit for special permission bits:

  • Setuid (4) - When set on an executable file (4755), the process runs with the effective user ID of the file owner rather than the user launching it.
  • Setgid (2) - On executables, runs with the file's group ID. On directories (2775), newly created files inherit the parent directory's group, which is essential for shared web-server or deployment folders.
  • Sticky Bit (1) - On shared directories such as /tmp (1777), prevents users from deleting or renaming files owned by other users even if the directory itself is world-writable.

Common Production Presets & FAQ

  • Why use 644 for files and 755 for directories? Regular web assets, PHP scripts, and configuration files do not need the execute bit for web servers to read them, so 644 (rw-r--r--) lets the owner edit while everyone else can only read. Directories, however, require the execute (x) bit to traverse into them (cd or resolve paths), making 755 (rwxr-xr-x) the standard safe default.
  • What permission should SSH private keys have? OpenSSH rejects private keys that are readable by group or others. Always set chmod 600 ~/.ssh/id_ed25519 and chmod 700 ~/.ssh.
  • When should I avoid 777? Almost always. Mode 777 allows any local user or compromised process to modify or execute the file. Instead of 777, assign proper ownership with chown or group write access with 775 / 664.
  • How do I apply permissions recursively? Use find /var/www/app -type d -exec chmod 755 {} + for directories and find /var/www/app -type f -exec chmod 644 {} + for files so you do not accidentally make static files executable.

Troubleshooting Permission Denied Errors in Practice

When a web application throws a Permission denied error, check three things in order: the file's permission bits, its owner and group (ls -l), and the permissions of every parent directory up to /. Remember that Linux requires the execute (x) bit on every parent directory in a path to traverse it - even if the target file itself is 644. In containerized deployments (Docker and Kubernetes), mounted volumes often inherit the host user's numeric UID/GID, so matching your container user or using 2775 with a shared group avoids having to relax permissions to 777.

Please read the privacy policy (agreement of the cookies usage, other websites embedded content, etc.). If you continue to use the site, we will assume that you agree with our privacy policy.
OkPrivacy Policy