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

Set supplementary groups for target user #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dev97
Copy link

@dev97 dev97 commented Mar 18, 2014

Please test and accept my patch for setting supplementary groups.

I'm sorry for missing documentation (with my English it would be easier to write it from scratch) and I'm sorry for missing formal tests (I afraid tests would be much more complex than code, mock-ups for getpwuid, getgrent would be needed and code would look uglier if to wrap $) access to a hook method, which is to be overridden by the testsuite).

I have tested it on my workstation (1. test without root permissions, 2. test with user with many groups, 3. test with user without supplementary groups) and on server as init.d script for real application.

I have also tested the case where 'uid' is specified without 'group' or 'gid' and there is no entry for such 'uid' in /etc/passwd. In this case 'gid' and supplementary groups remain intact. Probably it would be better to die in such case.

Introduce new parameter 'use_supplementary_groups'.

When 'use_supplementary_groups' is true and either 'user' or
'uid' is set, supplementary groups would be set according to
/etc/group. If 'gid' is also set, effective group id is set to
'gid', otherwise pw_gid from /etc/passwd is used.
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.

1 participant