-
Notifications
You must be signed in to change notification settings - Fork 254
useradd: Do not automatically add supplements groups for system users #1156
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: Do not automatically add supplements groups for system users #1156
Conversation
|
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.) |
Or, for example, only But at this moment, it works so that when creating a system user via Therefore, this new option was created, which allows maintainers to disable auto-addition of additional groups for system users. |
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 |
Ups sorry, I have mixed up the names. @AZaugg any opinion on the following topic?
|
f8867a7 to
cea62ec
Compare
cea62ec to
020334c
Compare
020334c to
d4cf7a6
Compare
|
@SgAkErRu yes, go ahead |
d4cf7a6 to
f24813a
Compare
f24813a to
e66eb7f
Compare
SYS_USER_AUTO_GROUPS_ENAB option
ikerexxe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation contains a flaw. The grp_add() function also sets do_grp_update = true in line 1950. That function is called when useradd is called with -U flag. That means that if a user is created with -U and without -G flags, then the logic you implemented will be executed. That's an undesired execution and it will leave some users without their default supplementary groups.
In addition, I added an inline comment. Probably the end code won't look like that once you fix the aforementioned flaw but it should be something similar.
Finally, one of the commits mentions useradd: fix test 69_useradd_default_GROUPS_name, what is it exactly you are fixing? I'm assuming you are adapting to the new GROUPS behaviour you are trying to implement, but I'd make it more obvious in the commit message.
But the new code check So, the new code check Or am I wrong? |
No, the behavior of the test itself does not change in any way and does not adapt to the current PR, because the current PR does not change the behavior for the regular user, only for the system user. And a new test number 70 has been created for the system user. The corrections are visible in the commit itself:
If necessary, I can add this information to the description of the commit. |
No, you are right. I must have misunderstood something but checking it again it behaves as you specified.
Please mention 1 and you can merge 2, 3 and 4 with |
Missing files have been added for the test to work: `gshadow`, `passwd`, `shadow`. Without them, the foo user was created with a different UID and thus the test failed. And other minor improvements, such as removing extra spaces and adding empty lines.
For regular and system user cases
e66eb7f to
c408dcd
Compare
ikerexxe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the patches
Do not automatically add supplements groups for system users that is created via the
-rflag.Before this change, groups from the
GROUPSparameter from the/etc/default/useraddfile were automatically added for the system user, which is most often undesirable (more precisely, I do not even know the case when it would be necessary).Related to: #586