I have a user tom whose primary group is also tom. I'd like to add another user jerry to that group. Running

$ sudo usermod -a -G tom jerry

has no effect at all (also after logging out and back in again). When I try to create a group tom I get:

$ sudo groupadd tom
groupadd: group 'tom' already exists

but interestingly

$ sudo adduser jerry tom
Adding user `jerry' to group `tom' ...
gpasswd: group 'tom' does not exist in /etc/group
adduser: `/usr/bin/gpasswd -a jerry tom' returned error code 3. Exiting.

and also

$ getent group tom

Is there anything I can do short of manually editing /etc/group?

  • What does getent group tom produce? Does it match grep ^tom: /etc/group? – Stephen Kitt Jul 28 '16 at 7:11
  • @StephenKitt Added getent ouput to the question. – hauptbenutzer Jul 28 '16 at 7:16
  • @Rahul wouldn't that set tom's primary group to jerry? That's not what I want to achieve. – hauptbenutzer Jul 28 '16 at 7:28
  • @hauptbenutzer you mentioned that you want to add another user jerry to tom's primary group – Rahul Jul 28 '16 at 7:29
  • 2
    Is group tom in /etc/group or is it defined somewhere else (NIS, LDAP)? – Mark Plotnick Jul 28 '16 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.