Managing Groups

Group Management

Managing groups is accomplished with the groupadd, groupmod, and groupdel commands on most Unix systems. groupadd has this syntax:

groupadd -g group_id group_name
 

To create a new group for the finance department called finance_2 and assign it a unique GID of 535, for example, you’d use:

groupadd -g 535 finance_2

This command makes the appropriate entry in the /etc/group file.
 

To modify a group, use the groupmod syntax:

groupmod -n new_modified_group_name old_group_name
 

To change the finance_2 group name to financial, type:

groupmod -n financial finance_2

You can also use the -g option with groupmod to change the GID of the group. Here’s how you’d change the financial GID to 545:

groupmod -g 545 financial
 

To delete an existing group, all you need are the groupdel command and the group name. To delete the financial group, the command is:

groupdel financial

This removes only the group,not any files associated with that group. (The files are still accessible by their owners.)

Unix

See Also
File Analysing Commands

Have a Unix Problem
Do you have a UNIX Question?

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.