$ man permissions
Engineering · Terminal and CLI
Permissions
File-level access rules that control who can read, write, or execute a file.
by Shawn Tenam
为什么重要
When you see "permission denied" in the terminal, permissions are the reason. Files have read, write, and execute flags for the owner, group, and everyone else. sudo runs a command as the administrator. chmod changes permissions. npm install errors, Homebrew ownership conflicts, script execution failures. All permissions issues.
你怎么用它
chmod +x script.sh makes a script executable. sudo npm install -g runs the install with admin privileges. If Homebrew gives permission errors, fix ownership with sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}. Read the error message. It usually tells you exactly which permission is missing.
相关术语