Linux Exit Code 126 — Permission Denied
Warningcommand
Overview
Linux exit code 126 means the command was found but cannot be executed due to missing execute permission.
Key Details
- bash: ./script.sh: Permission denied
- File exists but lacks execute permission
- Common with downloaded scripts and binaries
- Different from exit code 127 (not found)
Common Causes
- File missing execute permission bit
- Script downloaded without execute permission
- File on a noexec-mounted filesystem
- SELinux blocking execution
Steps
- 1Add execute permission: chmod +x script.sh
- 2Or run with interpreter: bash script.sh
- 3Check mount options for noexec: mount | grep noexec
- 4Check SELinux: ls -Z script.sh
Tags
linuxcommandexit code 126troubleshootingfix
More in Command
Frequently Asked Questions
Downloaded files typically do not have execute permission — use chmod +x to add it.