Skip to content

truffle-dev/tool-chmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

tool-chmod

A single-page Unix permission calculator. Type octal, type symbolic, or click bits in a 4x3 grid. Each input drives the others live. Includes setuid, setgid, and sticky, an ls -l preview that switches by entry kind, and a live chmod command with a configurable path.

Live: https://truffle.ghostwright.dev/public/tools/chmod/

What it does

Three ways in:

  • Octal field. Three digits (644) or four (4755). The leading digit, when present, is the special-bits nibble: setuid (4) + setgid (2) + sticky (1).
  • Symbolic field. Nine characters (rwxr-xr-x) or ten with a leading entry-kind character (-rwxr-xr-x). When a special bit is set, position 3 or 6 or 9 becomes s/S or t/T depending on whether execute is also set.
  • Bit grid. A 4x3 grid of user/group/other/special by read/write/ execute. Click any cell to toggle.

Four outputs:

  • Octal (4 digits). Always shown with the special-bits nibble, even when it's zero, so the shape is consistent.
  • Symbolic (9 chars). The rwxrwxrwx form, with s/S/t/T for the special bits.
  • ls -l preview. Ten characters, leading with the entry kind (-, d, l).
  • chmod command. Drop-in shell command with a path field. The leading zero is trimmed when the special-bits nibble is empty, so 0644 shows as chmod 644 path (matching the canonical form).

URL-hash state. #4755, #1777/d, #755/d/usr%2Flocal are all bookmarkable.

What it does not do

  • ACLs. setfacl/getfacl is a different model entirely.
  • Capabilities. setcap/getcap is another layer above the mode bits.
  • umask conversion. The complement is straightforward but adds a separate field for a separate concept.
  • Recursive chmod planning. The tool emits one command; the recursion is the operator's call.
  • Filesystem-specific extensions. Some filesystems extend the basic mode bits with sparse-file flags, append-only, immutable, and so on. Out of scope.

Notes that bit me

These appear in the reference section of the tool, but they're worth saying once here too.

  • OpenSSH refuses private keys with anything more permissive than 600. Symptom: Permissions 0644 for '~/.ssh/id_ed25519' are too open.
  • Directories need x to be entered. A directory at 755 can be listed and traversed. At 644 the contents are listable but no entry inside is reachable.
  • chmod -R treats files and directories the same. Use find . - type d -exec chmod 755 {} + and find . -type f -exec chmod 644 {} + to apply different modes to the two kinds.
  • setuid is silently dropped if the file is later modified by anyone other than root. Restore explicitly after edits.
  • setuid is ignored on shell scripts on Linux as a security measure. Only compiled binaries respect it.

Install

Open the live URL. Bookmark it. Save it for offline if you want; the HTML has no network dependencies.

To self-host, copy index.html to any static-file webroot. There is no build step.

License

MIT. See LICENSE.

Sibling tools

Full index: https://truffle.ghostwright.dev/public/tools/

About

Single-page Unix permission calculator. Octal, symbolic, bit grid, ls -l preview, chmod command.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages