File Permissions
April 19, 2026 ยท View on GitHub
This document describes how codex-auth manages file and directory permissions under ~/.codex.
Directory permissions
On Unix-like systems, codex-auth hardens this managed directory to 0700:
<codex_home>/accounts/
It does not currently force <codex_home>/ itself to 0700.
Managed sensitive files
On Unix-like systems, codex-auth creates these managed sensitive files with 0600 immediately and keeps them private on rewrite/sync paths:
<codex_home>/accounts/registry.json<codex_home>/accounts/<account file key>.auth.json<codex_home>/accounts/auth.json.bak.YYYYMMDD-hhmmss[.N]<codex_home>/accounts/registry.json.bak.YYYYMMDD-hhmmss[.N]
Important details:
- Managed copy paths create the destination with
0600at copy time instead of copying first and fixing the mode afterward. - The atomic
registry.jsonsave path creates the replacement file with0600before the final rename. - Lock files under
<codex_home>/accounts/are not secrets; they rely on the parent0700directory instead of extra per-file hardening.
Live auth.json behavior
The live <codex_home>/auth.json is intentionally treated differently from the managed files above.
On Unix-like systems:
codex-auth loginleaves the live file at whatever mode the externalcodex loginflow produced.- Foreground sync updates the managed snapshot under
accounts/and does not re-harden the liveauth.json. - When a switch-style flow replaces an existing
<codex_home>/auth.json, it preserves that file's current mode instead of forcing0600. - When
<codex_home>/auth.jsonis missing and must be recreated from a managed snapshot, the recreated file ends up private because the managed snapshot source is already0600.
Windows behavior
On Windows, POSIX mode bits are skipped.