I read the following about newgrp:
The newgrp command is used to change the current group ID during a
login session.
This made me think, how can I change my default's primary group permanently?
I imagine I can have a newgrp line in my startup files for my shell, but is there a way to change my primary ID for every login session without resorting to newgrp?
I am interested in a generic solution, but in case it depends on the distribution, I am interested in solutions for Ubuntu 11.10 and for Red Hat Enterprise Linux Server (I have administrator priviledges in the former, but not in the latter).
Addendum:
From the great answer @Shawn provided below to the these questions, I read "I won't be able to do this without root privileges".
This made me wonder: why? Assuming that I have privileges to run newgrp immiediately after login, wouldn't this be the same as changing my default primary GUID for all practical purposes?
newgrpto a startup script is the closest you can get without root privileges.If you were the admin of such a system and you wanted to let your users switch between a subset of groups without giving them root privileges, you could write a program to let them do it, and set the
– Shawn J. Goff Oct 22 '11 at 17:45setuidbit on the program.