Linuxexit code > 0

Permission denied

$bash: /usr/local/bin/script: Permission denied

Analysis

You do not have the required permissions (read, write, or execute) for the file or directory.

Common Triggers

  • Trying to run a script that isn't executable.
  • Trying to write to a root-owned directory as a normal user.

Debug Checks

  • $Check file permissions: ls -l <file>.
  • $Check your user ID: id.

Resolution

1
Add execute permission: chmod +x <file>.
2
Use sudo if the operation requires root privileges.
3
Change ownership: sudo chown $USER <file>.