Search code examples
cunixlanguage-agnosticposixerrno

Difference between EACCES and EPERM


What is the difference between EACCES and EPERM exactly? EPERM is described here as "not super user", but I would usually associate that with EACCES. In fact, I can't recall ever seeing an EPERM in real life.


Solution

  • EACCES is almost always used when the system call was passed a path that was inaccessible by the current user.

    EPERM is used in various other situations where you need to be root to perform an action, e.g.

    • kill() on a process that you don't own
    • link() on a directory
    • reboot()