EACCES 🐧 Linux

Linux: Permission denied

Your user (or the service user) lacks read/write/execute permission on a file, directory or one of its parents.

Seen on: Linux

Meaning

Linux checks permissions for the effective user on the file and requires execute (x) on every parent directory to traverse into it. Web servers run as www-data/nginx, not as you.

Common causes

  • File not readable/writable by the process user
  • Script missing execute bit (./script.sh: Permission denied)
  • Parent directory missing x permission
  • Files created by root via sudo
  • SELinux/AppArmor denying access
  • Filesystem mounted noexec

⚡ Quick fix

  1. ls -l file and namei -l /full/path to inspect permissions
  2. chmod +x script.sh for scripts
  3. sudo chown -R user:group dir to fix ownership
  4. Check SELinux: getenforce, ls -Z, audit2why

Detailed fix by platform

Linux

  1. Typical web app permissions:
    bash
    sudo chown -R www-data:www-data /var/www/app/storage
    sudo find /var/www/app -type d -exec chmod 755 {} \;
    sudo find /var/www/app -type f -exec chmod 644 {} \;
  2. Avoid chmod 777 — it fixes the symptom and creates a security hole.

How to diagnose

  1. User — Which user runs the process (ps aux)?
  2. Path — namei -l along the full path
  3. MAC — SELinux/AppArmor denials?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.