Difference between EACCES and EPERM

George Simms picture George Simms · Jan 26, 2016 · Viewed 8.9k times · Source

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.

Answer

duskwuff -inactive- picture duskwuff -inactive- · Jan 31, 2016

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()