Skip to content

Fix DynamicUser=yes with static User= whose UID and GID are different - #9720

Merged
keszybz merged 2 commits into
systemd:masterfrom
yuwata:fix-9702
Jul 26, 2018
Merged

keszybz merged 2 commits into
systemd:masterfrom
yuwata:fix-9702

Conversation

@yuwata

@yuwata yuwata commented Jul 26, 2018

Copy link
Copy Markdown
Member

Fixes #9702.

@yuwata

yuwata commented Jul 26, 2018

Copy link
Copy Markdown
Member Author

Are there any static user on Ubuntu whose uid and gid are different? Currently, the new test is meaningless on Ubuntu.

When DynamicUser=yes and static User= are set, and the user has
different uid and gid, then as the storage socket for the dynamic
user does not contains gid, we need to obtain gid.

Follow-up for 9ec655c.

Fixes systemd#9702.
@filbranden

Copy link
Copy Markdown
Contributor

Are there any static user on Ubuntu whose uid and gid are different? Currently, the new test is meaningless on Ubuntu.

Perhaps this one:

$ id games
uid=5(games) gid=60(games) groups=60(games)

Available on Ubuntu (18.04) and Debian (Stretch) it seems.

Also present on Fedora Rawhide, but it's a bit weirder there:

$ id games
uid=12(games) gid=100(users) groups=100(users)
$ getent group games
games:x:20:

😕

In any case, seems to fit the bill.

I guess one option is to create one explicitly for your tests. I imagine the tmpfiles tests already create users, no? Might perhaps want to do the same here...

@yuwata

yuwata commented Jul 26, 2018

Copy link
Copy Markdown
Member Author

Thanks. A test for Ubuntu or Debian is added which uses user games.


[Service]
Type=oneshot
ExecStart=/bin/sh -x -c 'test "$$(id -nG)" = "adm" && test "$$(id -ng)" = "adm" && test "$$(id -nu)" = "adm"'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sh is enough ;)

@keszybz

keszybz commented Jul 26, 2018

Copy link
Copy Markdown
Member

boot-and-services FAIL stderr: Failed to dump process list for '[email protected]', ignoring: Unit [email protected] not loaded.

@keszybz
keszybz merged commit 7426028 into systemd:master Jul 26, 2018
@yuwata
yuwata deleted the fix-9702 branch July 26, 2018 09:46
@yuwata

yuwata commented Jul 26, 2018

Copy link
Copy Markdown
Member Author

@poettering BTW, what do you think about also storing gid in the storage socket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants