Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man: document footgun on SocketUser= #32503

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion man/systemd.socket.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,12 @@
sockets and FIFO nodes in the file system are owned by the specified user and group. If unset (the
default), the nodes are owned by the root user/group (if run in system context) or the invoking
user/group (if run in user context). If only a user is specified but no group, then the group is
derived from the user's default group.</para>
derived from the user's default group.
Note that this might not have the desired effect if a socket happens to be inside a directory also
referred to in a <varname>RuntimeDirectory=</varname>, <varname>StateDirectory=</varname>,
<varname>CacheDirectory=</varname>, or <varname>LogsDirectory=</varname> of any service, due to the
change of ownership caused by these options.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not following? What's the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the issue description, SocketUser= is used to make the socket file owned by a different user than the service. If you however also have RuntimeDirectory= set, and your socket file is in there, both places try to chown this.

The common example for breakage is myservice wanting a /run/myservice/sock to be owned by otheruser.

If myservice also sets RuntimeDirectory=myservice, which chowns to myservice user, these two things race.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuntimeDIrectory= doing the chown is well-documented, but people using SocketUser= might not be aware of this conflicting. Hence the pointer.

</para>

<xi:include href="version-info.xml" xpointer="v214"/></listitem>
</varlistentry>
Expand Down