3 ms·
> Now, you might be wondering to yourself “Max, you said you weren’t running as root. How are you binding to port 80?” Well, sudo setcap CAP_NET_BIND_SERVICE=+e
by scottlamb 3y ago
> Now, you might be wondering to yourself “Max, you said you weren’t running as root. How are you binding to port 80?” Well, sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/busybox. But you could also run on an unprivileged port like 8080.
As you're launching from systemd anyway, I'd try something like `AmbientCapabilities=CAP_NET_BIND_SERVICE` in the unit file (caveat: untested). Then it's scoped to that unit, where it's (1) needed and (2) clear why it's needed. Instead of the busybox executable that (1) likely is used in a bunch of places where that's unneeded and (2) may get reinstalled by the package manager without this perm, quietly breaking your setup.
systemd also supports binding the port for you, but afaict from a quick skim, Busybox httpd doesn't support accepting the socket from systemd, so that wouldn't be as easy a change.
- tekknolagi 3y agoOh, neat! Thanks. I didn't know about AmbientCapabilities.