Linux
Jan 8, 2026 4 min read

Fix "Permission denied" Binding to Port 80 or 443 on Linux

Bind to privileged ports without running your app as root, using capabilities or sysctl.

Problem

bash
listen tcp :80: bind: permission denied

Root cause

Linux restricts ports below 1024 to processes with `CAP_NET_BIND_SERVICE`. Running as a non-root user normally means you can't bind 80 or 443.

Solution

Option A — grant the capability to the binary

bash
sudo setcap 'cap_net_bind_service=+ep' /opt/myapp/bin/server

Option B — lower the unprivileged port floor

bash
echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/99-low-ports.conf && sudo sysctl --system

Option C — front it with Nginx

Let Nginx own 80/443 and reverse-proxy to your app on a high port. Usually the cleanest answer.

Frequently asked questions

Related fixes

Weekly digest

One DevOps fix in your inbox each week

Short, practical, no fluff. Real errors, real fixes — straight from production postmortems.