Skip to content

Instantly share code, notes, and snippets.

View sstavar's full-sized avatar

Sebastian Stavar sstavar

View GitHub Profile
@sstavar
sstavar / codex-cli-sudo-tty-workaround-pkexec.md
Last active October 4, 2025 17:59
Guide—pkexec self-elevating scripts (avoid sudo/TTY pitfalls)

Handling Privileged Scripts Without TTY

Problem: sudo prompts can fail or corrupt input when there is no controlling TTY (e.g., tools running in raw mode inside Codex CLI).

Solution: run privileged work via self-elevating pkexec scripts so the desktop's Polkit agent collects credentials via GUI—no /dev/tty, no raw-mode surprises.

Quick start