The terminal froze. Commands failed. Zsh locked down, and every escape route was gone.
Zsh restricted access isn’t a bug. It’s deliberate. It’s a configuration that closes the doors on dangerous or unauthorized system actions. A restricted shell like Zsh in --restricted mode limits what a session can do — no changing directories, no setting environment variables in certain ways, no executing commands with a / in them, no running scripts from unexpected paths. The goal is simple: lock the session into a safe, predictable state.
When zsh -r starts, your world shrinks. It ignores $PATH changes. It blocks exec. It won’t let you overwrite critical built-ins with aliases. File redirections to arbitrary locations? Denied. This is not about making life harder; it’s about protecting systems from harm, by mistake or by design.
The most common reasons to use Zsh restricted mode are security and sandboxing. You might hand out shell access to a shared server but want to ensure no one can wander into sensitive directories. You might lock down a scripting environment so tasks can run in a clean, known context. This adds a layer of guardrails even if users already have limited privileges at the OS level.