DevTools Logo

Chmod Octal & Symbolic Permission Matrix

Chmod Octal & Symbolic Matrix

Convert Unix permissions between octal, symbolic notation, and ls -l output.

Permission matrix

Toggle read, write, and execute bits.

usergroupotherrwx

Examples

Round-trip a setuid mode

Input
parseOctal("4755") → toSymbolic
Output
rwsr-xr-x (octal 4755)

The leading 4 sets suid, so the user execute slot renders as s over x; parsing the symbolic form back returns 4755.

Conditional execute on file vs directory

Input
base 0644 with "a+X" (file) vs "a+X" (directory)
Output
file stays 0644; directory becomes 0755

Capital X is a no-op on a file without execute but sets execute on directories, matching chmod's directory-conditional semantics.

About this tool

chmod Symbolic Octal Matrix converts between the three Unix permission notations with a single ChmodMode model (r/w/x per user, group, and other plus suid, sgid, and sticky flags). parseOctal accepts 3 or 4 octal digits with an optional 0o prefix, pads to four digits, and decodes the leading digit as the special bits (4 suid, 2 sgid, 1 sticky); toOctal re-encodes the model as special plus three permission digits. Symbolic rendering follows ls conventions: s/s and t/T variants encode the execute-plus-special combinations, so 4755 becomes rwsr-xr-x, 2755 becomes rwxr-sr-x, 1777 becomes rwxrwxrwt, and 7777 becomes rwsrwsrwt.

parseSymbolic accepts nine permission characters with an optional d, -, or l type prefix, decoding s/S into suid/sgid and t/T into sticky while setting execute from any of x, s, or t in either case. applySymbolic evaluates comma-separated clauses of the form [ugoa]*[+\-=][rwxXst]* against a starting mode: a missing who defaults to a (all), = clears omitted r/w/x bits, X sets execute only on directories or files that already have execute, and the sticky bit may only target o or a. chmodSymbolicToOctal applies an expression onto a base mode (default 0000) and generateLsString formats a full ls -l style line with type prefix, owner/group placeholders, and filename.

The engine is deliberately stricter than GNU chmod in one place: permission-copy syntax such as g=u is rejected with Invalid symbolic clause because the mode alphabet is limited to rwxXst. Malformed input fails loudly — non-octal digits or wrong digit counts, symbolic strings that are not nine permissions, empty expressions, bad clauses like u+z or bare u, and misplaced sticky targets like u+t each throw a descriptive error — so invalid modes never silently render.

How to use this tool

  1. Convert octal to symbolic

    Enter a 3- or 4-digit octal mode such as 0755 or 4755. Read the nine-character symbolic form and watch s/S/t/T appear when the leading digit sets suid, sgid, or sticky.

  2. Convert symbolic back to octal

    Paste a nine-character string such as rwxr-xr-x, optionally prefixed with d, -, or l. The leading type letter is ignored for the mode; the nine permissions plus special-bit letters determine the octal digits.

  3. Apply a symbolic expression

    Start from a base mode and evaluate clauses such as u+x,g-w,o=r or a=rw. Use = to clear omitted bits, X for directory-conditional execute (toggle the directory flag when it matters), and commas to sequence clauses.

  4. Copy the ls preview

    Use generateLsString output (type + symbolic + placeholder owner/group/size/date/name) to paste an accurate ls -l style line into docs or reviews.

Use cases

Setting web-server permissions

Translate 0755 for executables and 0644 for content into symbolic form to confirm group/other write is absent before deploying.

Reviewing setuid and sticky bits

Decode modes like 4755, 2755, and 1777 into rws/rwt renderings to audit privileged executables and shared directories.

Previewing chmod expressions

Dry-run u+x,g-w,o=r or a+X clauses against a base mode to see the resulting octal before touching a real filesystem.

Common mistakes

Mistake:Using GNU copy syntax like g=u.

Fix:This engine only accepts rwxXst modes and rejects copies with Invalid symbolic clause. Spell the intended bits out explicitly (e.g. g=rx) instead.

Mistake:Expecting X to behave like x.

Fix:Lowercase x always sets or clears execute; capital X only acts on directories or files already executable. Set the directory flag or use x when unconditional execute is intended.

Mistake:Placing the sticky bit on u or g (e.g. u+t).

Fix:Sticky may only target o or a. Retarget the clause to o+t or a+t, and use s/S on u/g when a set-user/group bit is what is wanted.

Frequently asked questions

What does this tool do?

It converts between octal modes (3–4 digits, optional 0o prefix) and nine-character symbolic modes (optional d/-/l type prefix) including suid, sgid, and sticky bits, evaluates comma-separated symbolic clauses like u+x,g-w,o=r onto a base mode, and previews an ls -l style line.

Why do X, =, and g=u behave unexpectedly?

Capital X only sets execute on directories or files already executable (0644 + a+X stays 0644 on a file but becomes 0755 as a directory), = clears omitted r/w/x bits, a missing who defaults to a, sticky may only target o or a (u+t throws), and GNU copy syntax like g=u is rejected with Invalid symbolic clause — spell bits out explicitly.

Is anything I enter uploaded or stored?

No. Octal/symbolic parsing, clause evaluation, and ls-string formatting are pure client-side string and bit math — modes and expressions never leave your device.

How do I preview a chmod change safely?

Parse the current mode (e.g. 0644), apply the planned expression with the directory flag set correctly, and read the resulting octal plus the s/S/t/T symbolic rendering before running chmod for real — e.g. 4755 renders rwsr-xr-x and 1777 renders rwxrwxrwt.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML