Chmod Input

Chmod Input is a copy-paste React component that stops world-writable file or exposed key before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/chmod-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsWorld-writable file or exposed key

Was this component page useful?

How do I install Chmod Input?

pnpm dlx shadcn@latest add @bollard/chmod-input

The files land in your project. They're yours to edit.

How do I use Chmod Input in React?

chmod-input-usage.tsx
import { ChmodInput } from "@/components/ui/chmod-input"

<ChmodInput key={sample.name} path={sample.path} value={value} onValueChange={setValue} />

What input mistakes does Chmod Input catch?

  • World-writable files and directories, and setuid/setgid bits
  • Private keys and .env files readable by group or others
  • ~/.ssh or authorized_keys writable by others (sshd StrictModes rejects these)
  • Execute bits on data files, and 775 typed where 755 was likely meant
  • Short, symbolic or decimal-looking modes, read back exactly

What props does Chmod Input accept?

ChmodInput props
PropTypeDefault
value

Controlled text, exactly as typed (644, u+x, -rw-r--r--).

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the new text on every edit, toggle or fix.

(value: string) => void—
onModeChange

Called with the resulting numeric mode, or null when the text isn't a mode.

(mode: number | null) => void—
path

The file or folder this is for (~/.ssh/id_ed25519, uploads/). Its name decides which rules apply.

string—
kind

What it is, when the name doesn't say. Overrides the guess from `path`.

FileKind—
current

The current mode, the starting point for symbolic changes like u+x.

number—
umask

Umask for symbolic changes with no u/g/o. Default 0o022.

number0o022
groupShared

The group is meant to share write access (a team folder), so 775 isn't flagged.

booleanfalse
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{who}`, `{verbs}`, `{name}`, `{fix}`, `{detail}`, `{input}`, `{base}`, `{result}`, `{octal}` are filled in.

Partial<ChmodInputMessages>—

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is Chmod Input accessible?

  • Visible <label>; aria-invalid and aria-describedby to the readback and report
  • Summary in a role="status" region; an unreadable mode uses role="alert"
  • Permission grid checkboxes have aria-labels naming who and which right
  • After a fix, focus moves to the next fix or back to the field

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Set and audit permissions in your deployment tooling; this field only advises.

  • Judges by the path and kind you pass; it can't see the real file, owner or ACLs
  • Advice assumes a typical Linux/OpenSSH setup; shared-group setups may be intentional (groupShared)

What validation rules apply to Chmod Input?

Rules last verified:

Informational. Checked: StrictModes (default yes) checks file modes and ownership before login; authorized_keys must not be writable by others. Other per-file recommendations are conventions, not checked against a standard. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Chmod Input stop?

World-writable file or exposed key

Also known as

chmod · file permissions · rwx · unix permissions · octal mode · 755 · 644 · linux

Field type

What dependencies does Chmod Input require?

Chmod Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameChmod Input
Registry identifier@bollard/chmod-input
Install commandnpx shadcn@latest add @bollard/chmod-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Chmod Input

What form validation mistake does Chmod Input catch?

Chmod Input prevents world-writable file or exposed key. Reads a Unix file mode back in plain words and flags permissions that leak data or lock people out, like a world-readable key. Catches: World-writable files and directories, and setuid/setgid bits, Private keys and .env files readable by group or others, ~/.ssh or authorized_keys writable by others (sshd StrictModes rejects these), Execute bits on data files, and 775 typed where 755 was likely meant, Short, symbolic or decimal-looking modes, read back exactly. Limitation: validate chmod-input schemas on backend.

How do I install chmod-input with shadcn?

Run `npx shadcn@latest add @bollard/chmod-input`. Sources added: registry/default/chmod-input/chmod-input.tsx, registry/default/chmod-input/chmod.ts. Package requirements: lucide-react.

What props customize Chmod Input?

Chmod Input accepts `value`, `defaultValue`, `onValueChange`, `onModeChange`, `path`. Configures chmod, file permissions, rwx behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of chmod-input?

Judges by the path and kind you pass; it can't see the real file, owner or ACLs. Advice assumes a typical Linux/OpenSSH setup; shared-group setups may be intentional (groupShared) Server requirement: Set and audit permissions in your deployment tooling; this field only advises.

How does Chmod Input meet accessibility guidelines?

Visible <label>; aria-invalid and aria-describedby to the readback and report. Summary in a role="status" region; an unreadable mode uses role="alert". Permission grid checkboxes have aria-labels naming who and which right. After a fix, focus moves to the next fix or back to the field. Minimizes errors: chmod 777 bad, ssh key permissions too open.

Which components pair with Chmod Input?