Error Codes Wiki

Linux Permission Denied — chmod, chown & ACL Troubleshooting Guide

Warningpermissions

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

  1. 1Check permissions: ls -la /path/to/file (shows rwx + owner + group)
  2. 2Change ownership: sudo chown user:group /path/to/file
  3. 3Set permissions: chmod 755 /path/to/dir (rwxr-xr-x) or chmod 644 /path/to/file (rw-r--r--)
  4. 4Check ACLs: getfacl /path/to/file — set with: setfacl -m u:username:rwx /path/to/file
  5. 5Check SELinux: ls -Z /path/to/file — fix: restorecon -rv /path/to/dir

Tags

linuxpermissionschmodchownacl

More in Permissions

Frequently Asked Questions

Directories need execute (x) permission to be traversed. chmod +x /path/to/dir adds execute. Read only lets you list contents.