Run node.js on port less than 1024 without sudo

Steve Mu
1 min readJun 9, 2017

On Ubuntu

Normally, to run a program that bind to port less than 1024, it needs to be run as sudo. But not anymore, we can use this solution: https://gist.github.com/firstdoit/6389682

sudo setcap 'cap_net_bind_service=+ep' `which node`

After this, we can run node normally without sudo but still can bind to port 443 etc.

Why not just run as sudo?

Because nvm is per-user, per-shell. And running node as root is not a good practice.

--

--