Understanding the id command under Solaris

I can't tell you how many times I have had people call me about this one!

This is a classic: the id command does not return all the groups a user belongs to, only the primary.

andre@pegasus$ id andre
uid=1000(andre) gid=1000(andre) groups=1000(andre), 0(wheel)
gil@panix1$ id gil
uid=19319(gil) gid=99(users) groups=99(users),1001(net)

Now, under Solaris:

andre@galactus$ id
uid=1225(andre) gid=600(internal)

This looks good, unless you know that id also accepts the -a option:

andre@galactus$ id -a
uid=1225(andre) gid=600(internal) groups=122(sysadmin)

Oooops! Here comes another group!

This is incredibly annoying when, like me, you have users who belong to a great number of groups. Most of the time, the user asks you to belong to foobar, a new group. You do the necessary configuration... Only to have the user call you back and insult you because he does not belong to foobar! The reason being, of course, that he is using id to check the groups, and not id -a!

So, please remember that, to display all the groups a user belong to, you have to use id -a, and this option only works under Solaris.

See Also: