Developer tools · Chmod calculator
Finding world-writable files and setuid binaries with find -perm
· Why it matters
chmod unix access-control
Two permission patterns account for many real incidents: files anyone can change and programs that run as root. This post shows how to find both with find -perm and what to do about them.
The reviewer asks for a list you do not have — which files can any user modify, and which programs elevate privileges when run
A permission review often begins with modes already collected elsewhere: perhaps 0002, 4000, 2000, or a complete value such as 4755. The calculator can decode those numbers into owner, group, and other permissions, including the three special bits. It does not search directories, inspect binaries, or produce an inventory of paths.
Treat every supplied mode as a description of bits, not a verdict about a file. Enter it, compare the octal field with the symbolic display and checkbox matrix, then record what changed. Ownership, ACL entries, capabilities, and the identity of any process using the path remain facts to gather from the actual environment.
World-writable means the others class has w — the octal pattern 0002 and why -perm -0002 finds it regardless of other bits
The value 0002 isolates the other-write bit. In the ordinary three-class layout, the final digit belongs to everyone outside the owner and group classes, and its write component has weight 2. A complete mode containing that bit will therefore show w in the other class, although the calculator does not locate such modes itself.
Whether a particular find expression means exact, all-bit, or any-bit matching belongs to find documentation, not this converter. Supply a resulting mode instead. For example, 0666 becomes rw-rw-rw-, while 0644 becomes rw-r--r--; the difference is visible in the group and other write positions without implying that either mode suits a specific path.
0002 exposes the other-write bit; find matching semantics are external
The leading special-bit digit uses 4 for setuid and 2 for setgid. Thus 4755 combines setuid with ordinary 755 permissions, while 2755 combines setgid with the same trailing bits. The calculator exposes those masks separately and places their symbolic letters in the owner or group execute position when rendering the full mode.
Case carries useful evidence. If setuid accompanies owner execute, the owner execute position displays s; without execute it displays S. Setgid follows the same rule in the group position. These outputs decode a supplied integer, but they do not inspect a program, determine its owner, run it, or decide whether a special bit is justified.
4000 and 2000 decode as setuid and setgid without auditing binaries
Permission-search syntax must be kept separate from permission arithmetic. The calculator accepts an octal or nine-character symbolic mode and returns one twelve-bit value. It has no representation for a search operator, path predicate, or match rule, so an exact-mode query and an all-required-bits query cannot be distinguished inside this interface.
Decode the mode from each external search result rather than pasting the search expression. The three ordinary digits map to owner, group, and other, while an optional leading digit maps to setuid, setgid, and sticky. This workflow verifies the reported bits but leaves search coverage and matching semantics to the tool that produced the list.
Exact, all-bit and any-bit find modes need find documentation
Suppose an audit performed elsewhere reports 0666 and 4755. Entering 0666 yields rw-rw-rw-, making other-write visible in the last triple. Entering 4755 yields rwsr-xr-x: the owner has read, write, and execute, and setuid replaces the owner execute character with lower-case s because that execute bit is present.
A second hit such as 4644 demonstrates why the symbolic form matters. It renders rwSr--r--, with capital S showing setuid while owner execute is absent. The calculator can make that inconsistency conspicuous. It still cannot identify the path, establish who owns it, inspect its contents, or recommend removal of the bit.
Worked example: decode supplied audit hits without scanning paths
Do not repair every unusual mode automatically. A mode is only one input to a decision that also depends on the target, owner, group, and required operation. The page deliberately receives none of that context. Its command preview is inert text, and even a correctly quoted path is not opened or checked by the browser.
Before changing a reported mode, compare the current and proposed values one bit at a time. Removing other-write from 0666 produces 0664; removing setuid from 4755 produces 0755. Those arithmetic facts are reproducible, but whether either change preserves the workload requires local evidence beyond the calculator and beyond article 501's ordinary-bit walkthrough.
Exceptions and remediation require local ownership and workload evidence
Several relevant audit dimensions are absent. The route does not query ACL entries, file capabilities, ownership, writable path components, mount behavior, or mandatory policy. It also does not execute find, inspect a PATH, or traverse storage. A clean conversion therefore says only that the supplied number and displayed letters agree.
Keep those boundaries visible in any report. Record the path and collection method beside the decoded mode, then investigate identities and additional access mechanisms with appropriate external tools. The calculator is valuable as a notation check because it refuses invalid octal digits and exposes special bits; it is not a filesystem scanner or remediation engine.
Takeaway: know your writable and privileged files — and use the Chmod calculator to translate each suspicious mode before you change it
A useful permission audit separates discovery from interpretation. Let an external, documented process gather candidate paths, then use the calculator to translate each returned mode into explicit class permissions. Check the optional special-bit digit as carefully as the trailing three, since 0755, 2755, and 4755 share ordinary permissions but describe different twelve-bit values.
Finish with a narrow conclusion: which owner, group, other, and special bits the supplied mode contains. Do not turn that arithmetic into an unsupported claim about exposure or required policy. The calculator helps reviewers read suspicious modes accurately; the live system must supply ownership, workload, and enforcement evidence before anyone changes them.