Friday 24 August 2012

Linux Group Administration

A collection of users  is called as groups. Each Linux groups contains a unique ID value calledGID. Information of a Linux group is found in "etc/group" database file. 
In Linux we have 2 types of groups available.
1) Primary Group : The user in this group can access all the resources with default permission and have full access to all the resources.
2) Secondary group :  The user in this group have limited access to the resources which is decided by the admin that is user in primary group.
According to UPG scheme, if we create any user a primary group will be created with a same user name. A part from that, we can create a group manually. In group administration we use the following four commands.

1) groupadd   2) groupmod      3) groupdel      4) gpasswd

1) groupadd : With this command we can create a group account. If you want to create the group account with default options.
syntax  #groupadd [-g ]  [-o]] [-r] [-f] group 
     options :
                       -g gid : This is the group id no and it must be unique. It must be above then 500 as 0-499 is reserved for system account.
                      ex #groupadd -g 888 employee

2)groupmod :  The groupmod command modifies the system account files. 
                       Syntax #groupmod [-g ] [-o] [-n  ] group .  eg   #groupmod -g 999 sales 
                                   #groupmod -n newsales sales

3)  gpasswd :  This command is used to do the following task.
                       i) Assign the password to the group.
                      ii) Add or remove the secondary users of the group.

       Syntax : #gpasswd <options> <group-name>
Options:
           -a : To add single user 
             eg: #gpasswd -a sales
           -d: To delete a user
             eg: #gpasswd -d sales
           -M : Too add multiple user at a time
             eg: #gpasswd -M ul, ul1,ul3

4) groupdel : If the group is empty or if it is secondary user group then it can be deleted by the admin using this command. If the group has single primary user then you del the group account. 
                      syntax #groupdel <group-name>

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes