Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 549360

Summary: user.eclass: support 'sysusers.d'
Product: Gentoo Linux Reporter: Elias Probst <mail>
Component: EclassesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: fedora.dm0, leho, mgorny, sam, systemd
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.freedesktop.org/software/systemd/man/sysusers.d.html
See Also: https://bugs.gentoo.org/show_bug.cgi?id=702624
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 53269    
Bug Blocks:    

Description Elias Probst 2015-05-13 09:11:50 UTC
I'd like to see support for systemd's "sysusers.d" [1] in user.eclass.

This would allow straightforward user creation in stateless systems [2] which are built using Gentoo/binpkgs.

This would basically just mean, that 'enew{user,group}' would drop a per-package file into /usr/lib/sysusers.d/, e.g.

/usr/lib/sysusers.d/www-servers_apache-2.4.12.conf:
u apache 81 "Apache httpd" /var/www



[1] http://www.freedesktop.org/software/systemd/man/sysusers.d.html
[2] http://0pointer.net/blog/projects/stateless.html
Comment 1 Mike Gilbert gentoo-dev 2015-05-13 16:13:54 UTC
That's an interesting idea.

The first question that comes to mind would be how to handle the id assignment. We seem to have a few options. From the manual:

> For u and g the numeric 32bit UID or GID of the user/group. Do not use IDs 65535 or 4294967295, as they have special placeholder meanings. Specify "-" for automatic UID/GID allocation for the user or group. Alternatively, specify an absolute path in the file system. In this case the UID/GID is read from the path's owner/group. This is useful to create users whose UID/GID match the owners of pre-existing files (such as SUID or SGID binaries).

In summary:

- Specify a number for a static uid/gid.
- Specify a hyphen for a random uid/gid.
- Specify a path to grab the uid/gid from an existing file.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-12 04:59:09 UTC
I think this is done?

commit 0d096cb68e86dd5faa7da8cf68a18e4e29bc9081
Author: Michał Górny <mgorny@gentoo.org>
Date:   Fri Dec 13 17:32:09 2019 +0100

    acct-*.eclass: Create sysusers.d files

    Thanks to David Michael for the initial patch and upstream fixes.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>