2

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

Without the +, the secondary groups are set to the first given group. The manual hints that it's only with a + or - prefix that the -G option takes a list of groups:

When used with usermod or rolemod the –A, –G, –K, –P, and –R options may take a list of values to add or remove to the granted set using the [+|-] prefix.

0

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.