Error Codes Wiki

Linux Permission Denied — Cannot Execute Script Fix

Informationallinux command

Overview

Fix "Permission denied" when trying to run a script on Linux. The file lacks execute permission.

Key Details

  • Error: Permission denied (when executing)
  • Category: Linux Command Error
  • Script/binary lacks execute permission
  • Cannot run the file

Common Causes

  • File does not have execute (+x) permission
  • File downloaded from internet lost execute bit
  • File system mounted with noexec option
  • SELinux or AppArmor blocking execution

Steps

  1. 1Add execute permission: chmod +x script.sh
  2. 2Run with interpreter: bash script.sh (bypasses execute bit)
  3. 3Check mount options: mount | grep noexec
  4. 4Check SELinux: sestatus and audit log

Tags

linuxlinux-commandlinux permission denied execubuntuterminal

More in Linux Command

Frequently Asked Questions

Browsers and file transfers often strip execute permissions for security.