I have list of secondary group names eg group_1 group_2.. group_n
and a username eg : user1
Now i need to do
Make sure that all the groups are present
Make sure no extra groups are present
I tried using id -nG user1 | grep <group_1> | grep <group_2> | .. | grep <group_ n>
and evaluting the exitcode
but that only makes sure that required groups are present.I'm not sure how to verify no extra groups (groups not in my list) are present.