[systemd-devel] AF_INET socket ownership

Mantas Mikulėnas grawity at gmail.com
Wed Mar 4 18:05:51 UTC 2020


On Wed, Mar 4, 2020 at 7:26 PM Matt Zagrabelny <mzagrabe at d.umn.edu> wrote:

> Greetings,
>
> Do folks use non-root users to own AF_INET sockets
>

This bit *really* doesn't make sense. You're not changing the socket
ownership in your examples at all -- you're changing the *service's* user
account. Who owns the socket has nothing to do with who owns the service
process. (And the socket is still owned by root, as the whole point of
.socket units is that socket creation is handled by pid1.)

Indeed a very common use case for socket activation (including the original
inetd) is to have a privileged process create the socket, then pass it to
an unprivileged process. But it's the opposite of what you describe -- the
socket is owned by root but the daemon process isn't.

Either way, that's not specific to systemd .socket units at all -- many
services *already* work like that. You'll find many instances of services
having their own user accounts (httpd has its own, mariadb has its own,
sshd has its own...) Some of them even implement the "privileged listener"
model internally, e.g. httpd and sshd.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200304/ea3fbe4d/attachment.htm>


More information about the systemd-devel mailing list