Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Serious error in ensure_user_groups (in debian) #141

Open
jbzdak opened this issue Feb 20, 2014 · 0 comments
Open

Serious error in ensure_user_groups (in debian) #141

jbzdak opened this issue Feb 20, 2014 · 0 comments
Labels

Comments

@jbzdak
Copy link
Contributor

jbzdak commented Feb 20, 2014

There is a serious error in mentioned method

Here is implementation (at least the most revelant part):

    for user_group in groups:
        self.execute('usermod -G %s %s' % (user_group, username), stdout=False, sudo=True)

If I call ensure_user_groups('foo', ['group1', 'group2']) following statements would be called:

usermod -G group1 foo
usermod -G group2 foo 

While man usermod states:

   -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
      ...
       If the user is currently a member of a group which is not listed, the user will be removed from the group. This behaviour can be changed via the -a option, which appends the user to the current supplementary group list.

So this would result in foo being member of group1 as usermod -G group2 foo would remove foo from group1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants