Operation Not Permitted
Production Risk
Binding to privileged ports requires root or a capability grant. Ensure deployment scripts account for this.
The process does not have sufficient privileges to perform the requested operation. This is returned when a non-root process attempts an action that requires superuser capabilities, such as changing file ownership or binding to a privileged port.
- 1A non-root process tries to bind to a port below 1024.
- 2A process attempts to change file ownership without CAP_CHOWN capability.
- 3A process tries to set a signal handler for SIGKILL or SIGSTOP.
- 4A process attempts to write to a file protected by the immutable flag.
Running a server that binds to port 80 without root privileges.
// Node.js: binding to privileged port without root
const net = require("net");
net.createServer().listen(80);expected output
Error: listen EACCES: permission denied 0.0.0.0:80 errno: -13, code: EACCES, syscall: bind
Fix
Use a non-privileged port or run with elevated capabilities
WHEN When binding a server to a port below 1024
// Option 1: use a high port net.createServer().listen(8080); // Option 2: grant capability without full root // sudo setcap cap_net_bind_service=+ep /usr/bin/node
Why this works
Ports above 1023 do not require elevated privileges on Linux.
✕ Run the entire application as root to bypass this error
Running as root greatly expands the blast radius of any security vulnerability in your code.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev