1

I am trying to add 2 secondary groups for a user is Solaris system, but not able to do so. It only adds 1 secondary groups. I've done enough R&D, not sure what to do.

Below command I am using :

sudo usermod -g Primarygrp -G Secondarygrp1,Secondarygrp2 TJ252020

when I verify whether groups has been added or not, I use below command :-

id -Gn TJ252020

o/p I am getting- > Primarygrp Secondarygrp1

o/p I want -> Primarygrp Secondarygrp1 Secondarygrp2

1

According to the usermod(8) manual on Solaris, the group names should be prefixed by + to add them to the list of secondary groups.

I.e.,

usermod -g Primarygrp -G +Secondarygrp1,+Secondarygrp2 TJ252020

It is unclear from how the manual is written whether the Secondarygrp2 needs the + prefix or whether the first + applies to all groups listed (and I have no Solaris system to test on at the moment).

Without the +, the secondary group is set to the given group rather than appended (which may be why the second secondary group specified is ignored).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.