Thinking about a future web server setup, it struck me that for some reason web servers usually start as root and then drop certain rights (
setuid) for the worker processes. In addition there is often
chroot involved, which isn't exactly meant as a security measure.
What I was wondering, why can web servers (I have administrated everything from Apache, lighttpd to nginx) not use the capability system (
capabilities(7)), such as
CAP_NET_BIND_SERVICE, on Linux and simply start as non-root user? ... this way still listening on a privileged port below 1024.
Or better, I think most of them could, but why isn't that common practice? Why not ...
CAP_NET_BIND_SERVICEon the binary being run?
- set up the log folders to allow the (non-root) user to write there
- ..., if you felt like
chroothelps at all, use
lxcto "jail" the web server?
There is nothing other than (worker) child process may kill parent that I could come up with that would make this less beneficial than starting outright as
So why are they traditionally being started as root when afterwards everything is done to get rid of implied security issues that come with it?
www-data) should own said file. So that's not a good reason at all. And it was named before in an answer.