Change a users primary group after login


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Change a users primary group after login
# 1  
Old 02-08-2007
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
# 2  
Old 02-08-2007
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:
Quote:
S_ISGID Enables the setgid attribute for an executable file. A process executing this program acquires the access rights of the group of the file. Also, enables the group-inheritance attribute for a directory. Files created in this directory have a group equal to the group of the directory.
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.
This User Gave Thanks to Perderabo For This Post:
# 3  
Old 02-09-2007
Thank you. I tried newgrp and the results were not what I wanted. I will give the sticky bit a try. Thanx again. Smilie
# 4  
Old 02-09-2007
Umm.. it's the set gid bit, not the sticky bit. See Unix File Permissions
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Primary group

Is it possible user without a primary group (3 Replies)
Discussion started by: lobsang
3 Replies

2. UNIX for Advanced & Expert Users

Can adding to a new group be effective in current login environment without re-login?

Hey folks, When a user is added to a new group, the user has to be log out and log in again to make the new group effective. Is there any system command or technique to refresh user group ID update without re-login? I am not talking about to use "login" or "su -l" commands which can only make... (2 Replies)
Discussion started by: hce
2 Replies

3. AIX

change the primary dump device of a vio server

Hi how to change the primary dump device in a vio server ? $ ioslevel 2.2.0.11-FP-24 SP-01 $ oem_setup_env # sysdumpdev -l primary /dev/sysdumpnull secondary /dev/hd6 copy directory /var/adm/ras forced copy flag TRUE always allow dump TRUE dump... (1 Reply)
Discussion started by: newtoaixos
1 Replies

4. Shell Programming and Scripting

Script to list primary group of users

Dear All I am facing a problem with my script. I have to found the primary group of users . So first I selected all the groups and users register from a specific user : ONE Then I am making a file with all groups attached to the user : ONE Then I am making a file with all... (8 Replies)
Discussion started by: Aswex
8 Replies

5. Ubuntu

primary group for user

HI I need to know what is the primary group name of a particular user. How to do this ? Maybe with groups cmd ? (first group name in line, is the primary group) thx for help. (2 Replies)
Discussion started by: presul
2 Replies

6. Shell Programming and Scripting

Change of group to different users

Need to change the chgrp for different uses d---rwx--t 3 root 764 4096 Mar 16 2007 algavi d---rwx--t 6 root 2857 4096 Jul 16 11:28 alharki d---rwx--t 5 root 2739 4096 Oct 14 2008 alpen d---rwx--t 5 root 546 4096 Mar 16 2007 alvarez d---rwx--t 3 root... (2 Replies)
Discussion started by: gsiva
2 Replies

7. Shell Programming and Scripting

List ALL users in a Unix Group (Primary and Secondary)

Is there a command or better combination of cmds that will give me the list of Unix users in a particular Unix group whether their primary group is that group in question (information stored in /etc/passwd) or they are in a secondary group (information stored in /etc/group). So far all I got... (5 Replies)
Discussion started by: ckmehta
5 Replies

8. Shell Programming and Scripting

script to change default route when primary gateway dies

Hello all! We have two fedora routers one at each site. What we are trying to do worked using freesco but not on fedora, i'm not very good at scripting and need a little guidence. Basicly what we are trying to do is if the primary line dies, the router will change it's routes to go through our... (0 Replies)
Discussion started by: slacker
0 Replies

9. AIX

Change users login name

Hi, I need to change some users login name in AIX. With solaris i donīt had problems, i have used "usermod". But in AIX the usermod command donīt have the same behavior. Can someone give me a tip on how to perform these changes? Thanks in advance. (9 Replies)
Discussion started by: spacewalker
9 Replies

10. UNIX for Dummies Questions & Answers

How to find All Primary and Secondary Group ID's for a user

Is there any command which can list me all the Group ID's (Primary, Secondary ) assocaited with a single user. Thanks Sanjay (2 Replies)
Discussion started by: sanjay92
2 Replies
Login or Register to Ask a Question