Linux Permission Denied — chmod, chown & ACL Troubleshooting Guide
About Linux Permission Denied
Comprehensive guide to Linux permission denied errors covering file permissions, ownership, ACLs, SELinux contexts, and special permission bits (setuid, setgid, sticky). This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Linux file permissions use rwx (read, write, execute) for owner, group, and others. Numeric: 755 = rwxr-xr-x, 644 = rw-r--r--, 600 = rw-------. ACLs (Access Control Lists) provide finer-grained permissions beyond owner/group/other. SELinux security contexts add mandatory access control on top of standard permissions. Special bits: setuid (4), setgid (2), sticky (1) — prefix to numeric mode (e.g., 4755). Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: File owned by different user — current user has no access. Directory missing execute permission (needed to traverse/enter directory). SELinux context mismatch blocking access despite correct permissions. ACL entries overriding standard permissions. Immutable attribute set with chattr +i. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check permissions: ls -la /path/to/file (shows rwx + owner + group). Change ownership: sudo chown user:group /path/to/file. Set permissions: chmod 755 /path/to/dir (rwxr-xr-x) or chmod 644 /path/to/file (rw-r--r--). Check ACLs: getfacl /path/to/file — set with: setfacl -m u:username:rwx /path/to/file. Check SELinux: ls -Z /path/to/file — fix: restorecon -rv /path/to/dir. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
Why can I not enter a directory with read permission?
Directories need execute (x) permission to be traversed. chmod +x /path/to/dir adds execute. Read only lets you list contents.
Overview
Comprehensive guide to Linux permission denied errors covering file permissions, ownership, ACLs, SELinux contexts, and special permission bits (setuid, setgid, sticky).
Key Details
- Linux file permissions use rwx (read, write, execute) for owner, group, and others
- Numeric: 755 = rwxr-xr-x, 644 = rw-r--r--, 600 = rw-------
- ACLs (Access Control Lists) provide finer-grained permissions beyond owner/group/other
- SELinux security contexts add mandatory access control on top of standard permissions
- Special bits: setuid (4), setgid (2), sticky (1) — prefix to numeric mode (e.g., 4755)
Common Causes
- File owned by different user — current user has no access
- Directory missing execute permission (needed to traverse/enter directory)
- SELinux context mismatch blocking access despite correct permissions
- ACL entries overriding standard permissions
- Immutable attribute set with chattr +i
Steps
- 1Check permissions: ls -la /path/to/file (shows rwx + owner + group)
- 2Change ownership: sudo chown user:group /path/to/file
- 3Set permissions: chmod 755 /path/to/dir (rwxr-xr-x) or chmod 644 /path/to/file (rw-r--r--)
- 4Check ACLs: getfacl /path/to/file — set with: setfacl -m u:username:rwx /path/to/file
- 5Check SELinux: ls -Z /path/to/file — fix: restorecon -rv /path/to/dir