Add Group to User
Let's print current id of the user.
[root@primary01 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
In this case, we would like to add a new group called oper to the user.
The very first step, we create the group.
[root@primary01 ~]# groupadd -g 54323 oper
Append Groups
Then we add the group to the secondary group of the user.
[root@primary01 ~]# usermod -a -G oper oracle
[root@primary01 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper)
List All Groups
In Solaris, there's no -a option for usermod to append additional groups, so we have to list all secondary groups in the command.
[root@primary01 ~]# usermod -G dba,oper oracle
Basically, an user can have more than one secondary groups, but only one primary group. That is to say, if you want the new group to be the primary one, the only thing you can do is to replace the primary group of the user.