Change a users primary group after login

When users login, they are directed to menu (aix script). The menu enables the user to choose an environment to work in. Each environment has a different group id. When a user chooses a menu option, I want to change his primary group to that specific environment's group id. Is this at all possible ?

Thanx

Unix has been designed to render such an operation as unneeded. So why do you want to do this? A user can access files based on secondary groups. If you are concerned about controlling the gid of newly created files, you can do that by setting the sgid bit in the directory. I checked the man page for chmod on AIX 5.3 and I found this language:

In the old days, we would need to change the primary group because secondary groups had not been invented. The newgrp command still exists in many versions of unix, including AIX, and you can use it if you want. But don't be surprised if you don't like it very much.

1 Like

Thank you. I tried newgrp and the results were not what I wanted. I will give the sticky bit a try. Thanx again. :slight_smile:

Umm.. it's the set gid bit, not the sticky bit. See Unix File Permissions