Operating System - HP-UX
1832547 Members
6706 Online
110043 Solutions
New Discussion

Re: How can I change GID of a user group?

 
cbozlagan
Regular Advisor

How can I change GID of a user group?

How can I change GID of a user group?

Thanks
6 REPLIES 6
Piergiacomo Perini
Trusted Contributor

Re: How can I change GID of a user group?

Hi cbozlagan,

read carefully "man setuid".

hth
regards
pg
Matti_Kurkela
Honored Contributor

Re: How can I change GID of a user group?

"man groupmod" might be more useful, if I understood your question correctly.

MK
MK
cbozlagan
Regular Advisor

Re: How can I change GID of a user group?

Thanks for your help

My system doesn't include setuid and setgid statements.

Now I have another question:

How can I delete user group?

Thanks
Reshma Malusare
Trusted Contributor

Re: How can I change GID of a user group?

For modifying group attributes use
groupmod command...
check man pages for groupmod

For deleting group
groupdel


Thanks & Regards
Reshma
Bill Hassell
Honored Contributor

Re: How can I change GID of a user group?

> How can I change GID of a user group?

I'm not sure I understand the question. The GID is a number and is associated with a name in the /etc/group file. If you edit the /etc/group file, then the name associated with a number can be changed. HP-UX only keeps the number for files and user associations -- the name is simply an alias to the number.

> My system doesn't include setuid and setgid statements.

Actually, it does. If you mean that the command:

man setuid

fails with the error: No manual entry for setuid, then someone has removed some man pages, perhaps all of them (a very, very bad idea). The man page for groupmod will be useful if you need to redefine a GID or group name. If your man pages have been trashed, see all the man pages here:

http://docs.hp.com/en/B2355-60103/
specifically for groupmod:
http://docs.hp.com/en/B2355-60103/groupmod.1M.html

> How can I delete user group?

As mentioned before, groups are simply numbers. Removing the line in /etc/group just removes the name association with the number. Files and users still retain the numbers. Are you trying to remove a group from a user's definitions? If yes, then use SAM to change the user's primary group, or if the user is a member of additional groups, you can remove the user's association by editing /etc/group and removing the user's name from specified group(s).


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: How can I change GID of a user group?

As Bill says, do you want to change the number or the name?

If /etc/group has 99 for FOO, you could have 100s of users with GID of 99. To change that you would have to edit all the users, then change ALL of the files to your new GID.

I.e. you don't want to do that.

If you want to change the name of the group, you just edit the file.

> My system doesn't include setuid and setgid statements.

>Bill: Actually, it does.

Strictly speaking it doesn't. setuid(2) is a system call and not a command like groupmod(1M). And I don't think cbozlagan is interested in changing it dynamically in an application.