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
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026