How do you troubleshoot "Permission denied" on Linux?
⚡
Quick Answer
The user lacks the required permission on the file/dir/operation. Check ownership and mode with ls -l, the effective user with id, ACLs with getfacl, and whether SELinux/AppArmor or sudo policy is blocking it.
Detailed Answer
Verify the file mode and owner (ls -l), your identity (id), and extended ACLs (getfacl). Fix with chmod/chown as appropriate — but least privilege, not chmod 777. On RHEL, SELinux denials (ausearch/journalctl for AVC) are a common hidden cause; check with sestatus. For privileged ops, confirm sudo rules (sudo -l).
Code Example
ls -l <path> id getfacl <path>
💡
Interview Tip
Mention SELinux/AppArmor as the hidden cause when file perms look correct — and never suggest chmod 777.
linuxpermissionstroubleshooting