After I look through the help. I didn't found much difference between them.
-g, –gid GROUP
The group name or number of the user's initial login group. The group
name must exist. A group number must refer to an already existing
group.-G, –groups GROUP1[,GROUP2,…[,GROUPN]]]
A list of supplementary groups which the user is also a member of.
Each group is separated from the next by a comma, with no intervening
whitespace. The groups are subject to the same restrictions as the
group given with the -g option. The default is for the user to belong
only to the initial group.
If they are the same. Why both they exist?
Best Answer
-g
sets the initial, or primary, group. This is what appears in the group field in/etc/passwd
. On many distributions the primary group name is the same as the user name.-G
sets the supplementary, or additional, groups. These are the groups in/etc/group
that list your user account. This might include groups such assudo
,staff
, etc.