Pcornel
Linux · Linux Troubleshooting

Permission Denied

Cheat sheet · https://pcornel.dk/topic.php?topic=2917

Back to the Topic

Answer

"Permission denied" (EACCES/EPERM) means the kernel refused an operation: file mode, ownership, ACL, a missing execute bit on a directory, a read-only or noexec mount, SELinux/AppArmor, or capabilities.

Remember

Check as the actual user, along the whole path. If mode bits look right, check ACLs, mount options and the MAC framework (SELinux/AppArmor) logs.

First checks

  • journalctl -b -p err — errors this boot
  • systemctl --failed — failed units
  • df -h; df -i — space and inodes
  • ss -tulpn — listening sockets
  • dmesg -T | tail — recent kernel messages

Commands

id <user>
systemctl show <unit> -p User -p Group -p SupplementaryGroups
findmnt -T <path>
systemctl show <unit> -p ProtectSystem -p ProtectHome -p ReadWritePaths
findmnt -T /path

Verify in this order

process with UID/GID → path walk (x on directories) → mode/ACL → mount options → SELinux/AppArmor → allowed

Where it usually breaks

First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2917

Confirmation

Confirm action

Continue?