Changing the Effective Group ID


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Changing the Effective Group ID
# 1  
Old 12-05-2002
Changing the Effective Group ID

Here is my situation. On a RedHat 7.3 box, I have a user named jody.

When I log in with jody and type in "id", I get the expected output:
uid=1(jody) gid=1(jody) groups=1(jody), 510(test)

However, I cannot figure which "id" option allows me to change the effective gid. I tried the options given to me in the help menu and the man pages, but that did not work. Am I completely off-base by expecting "id" to allow me to change the effective gid from 1(jody) to 510(test)?
# 2  
Old 12-05-2002
I'm not sure if this works in Red Hat but in HP-UX you can use a command called newgrp.

usage: newgroup - test
# 3  
Old 12-05-2002
The id command displays your id, it doesn't alter it. The newgroup command changes your group id, not the effective group id.

If you really want to change the effective gid (which does not really make any sense), try the following commands. You will need to use a valid group on your system and maybe a different shell than ksh...

cp /usr/bin/ksh /tmp
chgrp nuucp /tmp/ksh
chmod 2555 /tmp/ksh # this may require root to work
/tmp/ksh
id

You should see "egid=nuucp(11)" or something like that depending on what group you used.

The su command is owned by root and has permissions of 4555 which makes it suid to root. So you can run it as an ordinary user but it can take actions that require root power. While the su command is running, the uid is your account and euid is root. The egid is similiar. You probably have some sgid programs and "find /usr/bin -perm -2000 -perm" will find them.

Originally a process could have only one group at a time. And you used newgroup to change your group. BSD introduced multiple groups, so now a process can be in many groups. After that the newgroup command wasn't used anymore. HP-UX supports both schemes. But most HP-UX users go with the multiple group at once scheme.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Red Hat

Can't chgrp. Error - chgrp: changing group of `<file>': Invalid argument

I found that I cannot chgrp for some reason with error: chgrp: changing group of `<file>': Invalid argument This happens on all NFS mounted disks on client machines. We use AD (not my call) for authentication and it also provides groups. We have a NFS server running Scientific Linux 6.3... (1 Reply)
Discussion started by: venmx
1 Replies

3. Shell Programming and Scripting

perl :Changing script to only find the group

Hi scripting guru's I found this script on IBM's website and it seems to be really good only thing it gives off more info than i need. I was wondering if someone could help me modify it to only find a group instead of every user. (group is support) I believe i know how to add the line so it... (2 Replies)
Discussion started by: vpundit
2 Replies

4. UNIX for Dummies Questions & Answers

Changing rights without touching user and group?

Hello, I have a small problem and would be happy if someone could help me to find a solution: A machine ("server") makes backups of different computers ("clients") using rsync. Users and groups are keept, so that it's possible to copy them back to the client if required. The number of groups... (3 Replies)
Discussion started by: tracer
3 Replies

5. UNIX for Dummies Questions & Answers

regarding changing ownership and group

i am able to change the mode using chmod and able to change permission. but i am not able to change group and ownership. getting as invalid can any one help me regarding this . (4 Replies)
Discussion started by: satheeshkr_cse
4 Replies

6. Solaris

Changing root group to group from other

Does any one know if changing root's group from “other” to “root” will cause any problems on a running system. Thanks (4 Replies)
Discussion started by: mjkroner
4 Replies

7. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

8. Filesystems, Disks and Memory

changing group ID

My current GID are all < 100, however I am having issues now with this. Does anyone know of a way to change all GID's to perhaps add 100, IE so GID now = 23 will = 123. I am running an NIS network so changing the table is easy , however finding all the files on all my filesystems and modifying... (4 Replies)
Discussion started by: frankkahle
4 Replies

9. UNIX for Advanced & Expert Users

File group ownership changing automatically

Hi everyone, Need help with an issue. The group ownership of files on my Solaris system is getting changed automatically. Could someone tell me the reason why? And how could I correct it? One more info- everytime the ownership changes, it changes to "x". Thanks :confused: (1 Reply)
Discussion started by: top_gun
1 Replies

10. Cybersecurity

Changing effective user

I would like to give execution rights for a script to one user. (that's the easy part...) When that user is running the script, I would like the effective user ID to be that of the file-owner. Is this possible? (6 Replies)
Discussion started by: hilmel
6 Replies
Login or Register to Ask a Question