The cursor blinks in your terminal, waiting. Every command you run has the power to change a system. That power is dangerous if you give it too much reach.
Least privilege in Zsh is about cutting that reach to the minimum necessary. It means configuring your shell so commands, scripts, and environments run with only the permissions they need — nothing more. This is not a vague security concept. It’s a concrete defense against accidental damage, malicious code, and privilege escalation.
Start by isolating user permissions. Run Zsh as a non-root user for all daily work. Only invoke elevated privileges with sudo when required. Avoid making your Zsh profile or configuration files writable by all users. Lock down ~/.zshrc and any sourced scripts with chmod 600 to prevent injection attacks.
Reduce your $PATH to trusted directories. Drop . from $PATH to avoid executing files from the current working directory. Keep environment variables minimal. Secure functions in your Zsh configuration by using local variables to prevent leaks and overrides.