Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

Add and delete groups

Add and delete groups

●Add a group

To create a group, use the groupadd command.
When executing this command, specify the group name to be added as an argument. You will need root privileges to run this command.

[root@Lion ~]# groupadd newgr  ←Create a new group newgr
[root@Lion ~]# cat /etc/group | grep newgr ←Check the group you have created
newgr:x:503:

●Add a group by specifying the group ID.

When you add a group, the Linux system will automatically assign a GID (Group ID).
This makes it inconvenient when you want to operate and manage the system with GID regularity for system administration. In such a case, execute the groupadd command with the "-g" option to specify the GID.
You will need root privileges to run this command.

[root@Lion ~]# groupadd -g 600 newgr ←Create a group newgr with a GID
[root@Lion ~]# cat /etc/group | grep  newgr ←Check the group you have created
newgr:x:600:

Delete a group

To delete a group, use the groupdel command.
For the argument, enter the name of the group you want to delete and execute.
However, if there is a user whose primary group is the group to be deleted, that user must be deleted first before the group can be deleted.

[root@Lion ~]# cat /etc/group | grep newgr ←Check the newgr floupe.
newgr:x:503:
[root@Lion ~]# groupdel newgr ←Delete the newgr group
[root@Lion ~]# cat /etc/group | grep newgr ←Make sure that the newgr group has been deleted
タイトルとURLをコピーしました