Linux: Permission denied
Your user (or the service user) lacks read/write/execute permission on a file, directory or one of its parents.
Permission deniedOperation not permitted 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
xpermission - Files created by root via sudo
- SELinux/AppArmor denying access
- Filesystem mounted
noexec
⚡ Quick fix
ls -l fileandnamei -l /full/pathto inspect permissionschmod +x script.shfor scriptssudo chown -R user:group dirto fix ownership- Check SELinux:
getenforce,ls -Z,audit2why
Detailed fix by platform
Linux
- 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 {} \; - Avoid
chmod 777— it fixes the symptom and creates a security hole.
How to diagnose
- User — Which user runs the process (
ps aux)? - Path —
namei -lalong the full path - MAC — SELinux/AppArmor denials?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Linux
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026