As anyone who has used usermod to add a user to a group knows, invariably a mistake will be made (probably once in a career and not again) in which -a is forgotten and the secondary groups are overwritten with uucp or some other group with low permissions, locking the user out.

What is the historical reason for the default for usermod being to exhibit the behaviour that few people want of overwriting the secondary groups?

  • 1
    I guess it's because it doesn't have a good way to otherwise remove secondary groups... So -a works to add new, but if you want to remove or replace then you need to specify them all... – filbranden Apr 21 '18 at 3:57
  • @FilipeBrandenburger Perhaps, but why does replacing the groups not require a flag? – Yet Another User Apr 21 '18 at 4:33
  • usermod command can use to add user to secondary group. – Eranda Peiris Apr 21 '18 at 4:56
  • @ErandaPeiris I am aware. I'm asking about the historical reason for it overwriting secondary groups by default instead of requiring a flag to do so. – Yet Another User Apr 21 '18 at 5:22
  • 2
    man.openbsd.org/usermod : -G and -S, no -a. "past": nixdoc.net/man-pages/HP-UX/man1/usermod.1m.html : -G and nothing. – A.B Apr 21 '18 at 9:00

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.