Friday 26 August 2011

Group Administration in Linux

Creating a Group

Syntax:- 

[root@localhost~]# groupadd <groupname>

                          (or)

[root@localhost~]# groupadd <option> <argument> <groupname>

Options:

-g -- Group ID
-0 -- Override


Example:- Creating a group Sales with default options

[root@test119 ~]# groupadd sales


To check if the group has been created

[root@test119 ~]# tail -5 /etc/group

avdefs:x:504:
ali:x:2001:
tom:x:2002:
anu:x:2003:
sales:x:2004:


Example:- Creating a group mktg whose group id (GID) is 750

[root@test119 ~]# groupadd -g 750 mktg

To check if the group has been created

[root@test119 ~]# tail -5 /etc/group

ali:x:2001:
tom:x:2002:
anu:x:2003:
sales:x:2004:
mktg:x:750:


Modifying the Properties of a Group


Syntax:-

[root@localhost~]# groupadd <option> <argument> <groupname>

Options:

-g -- Group ID
-o -- Override
-n -- Group Name


Example:- Change the GID of the group sale to 800

[root@test119 ~]# groupmod -g 800 sale

To check if the group ID has changed

[root@test119 ~]# tail -5 /etc/group

tom:x:2002:
anu:x:2003:
sales:x:2004:
mktg:x:750:
sale:x:800:

Deleting a group

Syntax:-

[root@localhost~]# groupdel <groupname>

Example:- Delete the group sale

[root@test119 ~]# groupdel sale


To check if the group has been deleted

[root@test119 ~]# tail -5 /etc/group ali:x:2001:
tom:x:2002:
anu:x:2003:
sales:x:801:
mktg:x:750:


0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews