Interview Prep/Networking/Sockets, ports, TIME_WAIT and conntrack

A Node.js service fails to start with `Error: listen EACCES: permission denied 0.0.0.0:80`.

BeginnerTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer

Likely causes → Ports below 1024 are privileged; a non-root process needs CAP_NET_BIND_SERVICE, or the system must lower net.ipv4.ip_unprivileged_port_start.

Diagnose →

id
sysctl net.ipv4.ip_unprivileged_port_start
getcap $(which node)

Fix → Pick one:

# systemd unit
AmbientCapabilities=CAP_NET_BIND_SERVICE
# or listen on 8080 and put nginx / an LB on 80
# or (containers) run on 8080 and map -p 80:8080

Avoid setcap on the shared node binary; it grants the capability to every Node script.

Prevent → Run apps on high ports behind a reverse proxy or LB; never run them as root just to bind 80.

All Networking questions Roadmap: Networking for DevOps

More on Sockets, ports, TIME_WAIT and conntrack