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

useradd: SYS_USER_AUTO_GROUPS_ENAB option #1156

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

SgAkErRu
Copy link
Contributor

A new SYS_USER_AUTO_GROUPS_ENAB option in /etc/login.defs that control whether supplementary groups are automatically added for the system user that is created via the -r flag.

Default value is no, so groups from the GROUPS parameter from the /etc/default/useradd file are not added automatically for the system user.

Related to: #586

@alejandro-colomar
Copy link
Collaborator

alejandro-colomar commented Dec 17, 2024

Could you please explain why we want this?

Isn't this another way of having an empty GROUPS list? Why not have an empty GROUPS list instead? (I'm not sure I liked the GROUPS list in the first place.)

@SgAkErRu
Copy link
Contributor Author

Could you please explain why we want this?

Isn't this another way of having an empty GROUPS list? Why not have an empty GROUPS list instead? (I'm not sure I liked the GROUPS list in the first place.)

GROUPS allows maintainers to set a list of additional (supplementary) default groups, for example users, dialout, audio, serial and so on.

Or, for example, only users, which is then expanded through the libnss-role, i.e. these groups (dialout, audio, serial) are added through libnss-role to those users who are in the users group.

But at this moment, it works so that when creating a system user via useradd --system or useradd -r, these groups are also added to it, which is most often undesirable (more precisely, I do not even know the case when it would be necessary).

Therefore, this new option was created, which allows maintainers to disable auto-addition of additional groups for system users.

src/useradd.c Outdated Show resolved Hide resolved
src/useradd.c Outdated Show resolved Hide resolved
src/useradd.c Outdated Show resolved Hide resolved
@ikerexxe
Copy link
Collaborator

But at this moment, it works so that when creating a system user via useradd --system or useradd -r, these groups are also added to it, which is most often undesirable (more precisely, I do not even know the case when it would be necessary).

Since you are the original author of this functionality and you don't know the case, why don't you filter the group membership addition for non-system users instead of creating a new option? I think that would be the most sensible approach.

@SgAkErRu
Copy link
Contributor Author

SgAkErRu commented Dec 17, 2024

But at this moment, it works so that when creating a system user via useradd --system or useradd -r, these groups are also added to it, which is most often undesirable (more precisely, I do not even know the case when it would be necessary).

Since you are the original author of this functionality and you don't know the case, why don't you filter the group membership addition for non-system users instead of creating a new option? I think that would be the most sensible approach.

Because I am not original author of this functionality.

So, that's why I suggest this option, which will keep the possibility of the original behavior (when these groups automatically adds to system users).

P.S But in general, with the option, it seems to me a more flexible.

I mean, the GROUPS feature itself with SYS_USER_AUTO_GROUPS_ENAB enabled will be like a complete alternative to specifying default supplementary groups using -G.

@ikerexxe
Copy link
Collaborator

Because I am not original author of this functionality.

Ups sorry, I have mixed up the names.

@AZaugg any opinion on the following topic?

But at this moment, it works so that when creating a system user via useradd --system or useradd -r, these groups are also added to it, which is most often undesirable (more precisely, I do not even know the case when it would be necessary).

Since you are the original author of this functionality and you don't know the case, why don't you filter the group membership addition for non-system users instead of creating a new option? I think that would be the most sensible approach.

@SgAkErRu SgAkErRu force-pushed the useradd-sys-user-auto-groups-option branch from f8867a7 to cea62ec Compare December 17, 2024 15:44
src/useradd.c Outdated Show resolved Hide resolved
@SgAkErRu SgAkErRu force-pushed the useradd-sys-user-auto-groups-option branch from cea62ec to 020334c Compare December 17, 2024 15:56
src/useradd.c Outdated Show resolved Hide resolved
@SgAkErRu SgAkErRu force-pushed the useradd-sys-user-auto-groups-option branch from 020334c to d4cf7a6 Compare December 18, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants