Unix Permissions Calculator
Calculate Unix file permissions interactively. Convert between octal (755) and symbolic (rwxr-xr-x) notation with checkboxes or direct input.
755rwxr-xr-xchmod 755 filename-rwxr-xr-xCommon Permission Presets
About This Tool
The Unix Permissions Calculator is an interactive tool for system administrators, developers, and DevOps engineers who work with file permissions on Linux, macOS, and other Unix-like operating systems. Instead of manually calculating octal values or memorizing which bits correspond to which permissions, this visual calculator lets you click checkboxes and instantly see the corresponding octal number, symbolic notation, and ready-to-use chmod command.
Understanding the Unix Permission Model
The Unix permission model, designed in the 1970s, remains one of the most elegant and widely-used access control systems in computing. Every file and directory in a Unix filesystem has an associated set of permissions that determine which users can perform which operations. The model divides users into three categories: the file owner (typically the user who created the file), the group (a collection of users who share a common group ID), and others (everyone else on the system). Each category can independently be granted or denied read, write, and execute permissions.
Permission Bits Explained
Read permission (r, value 4) on a file allows viewing its contents with commands like cat, less, or any text editor. On a directory, read permission allows listing the directory contents with ls. Write permission (w, value 2) on a file allows modifying its contents, including truncating it to zero length. On a directory, write permission allows creating, renaming, and deleting files within the directory. Execute permission (x, value 1) on a file allows running it as a program or script. On a directory, execute permission allows accessing the directory, which means entering it with cd and accessing files within it by name. Without execute permission on a directory, you cannot access any files inside it even if you know their names.
Octal Notation Deep Dive
Octal notation compresses nine permission bits into three digits. Each digit is the sum of the permission values for one category: read (4) plus write (2) plus execute (1). The digit 7 means all permissions (4+2+1), 6 means read and write (4+2), 5 means read and execute (4+1), 4 means read only, 3 means write and execute (2+1), 2 means write only, 1 means execute only, and 0 means no permissions. Learning to read octal permissions becomes second nature with practice: 755 instantly conveys that the owner has full control while group and others can read and execute but not modify.
Security Best Practices
The principle of least privilege dictates that files should have the minimum permissions necessary for their intended use. Configuration files containing passwords or API keys should use 600 (owner read/write only). Application code that does not need to be modified in production should use 444 or 555. Shared directories should use the setgid bit so that new files inherit the group. The sticky bit on shared writable directories like /tmp prevents users from deleting each other's files. Never use 777 in production environments as it grants full access to every user on the system, creating a significant security vulnerability that can be exploited by compromised processes or malicious users.
Common Permission Patterns
Web applications typically need 755 for directories (so the web server can enter and list them) and 644 for files (so the server can read them). CGI scripts and executable files need 755. Upload directories might need 775 if the web server and application run as different users in the same group. SSH private keys require 600 or they will be rejected by the SSH client. Database files should use 640 with the database service user as owner and the application user in the group. Understanding these patterns and the reasoning behind them is essential for maintaining secure systems.
Frequently Asked Questions
What are Unix file permissions?
How do octal permission numbers work?
What is the difference between symbolic and octal notation?
What permissions should I use for web server files?
What is the chmod command and how do I use it?
What are setuid, setgid, and the sticky bit?
Was this tool helpful?