Thursday, May 1, 2014

Group Management in Linux


Group Management :

 
  • A user can be participated to more than one group at the same time.
  • A user who is member of a group can change to that group without password but a user NOT member can only change to that group if the group password exist and the user gives it.
  • One of more users can become group administrators for specific groups.
  • Group Administrators can:
1.     add/change/delete the password of the group
2.     add/delete users to the group
3.     reserve the group to members-only.

Types of Group:

  • Primary group: Every user must be a member of at least one group, which is identified by the numeric GID in /etc/passwd.
  • Secondary group: A user may be listed as member of additional group in the relevant entries in the /etc/group.
  • User private group: Created whenever a new user is added to the system and has the same name as the user for which it was created.

Example:

$ id
uid=501(linuxcare) gid=502(linuxcare) groups=502(linuxcare),506(rax)


Group Management Commands:

  • groupadd - adding group
      # groupadd admin
      # groupadd -r admin            //start group id 101 and increase up to GID 499
      # groupadd -g 600 admin

  • groupmod - modifying group
      # groupmod [-g new gid] [-n new name] group
      # groupmod -g 600 -n networkcare linuxcare

  • groupdel - deleting group
      # groupdel networkcare

  • gpasswd - administer /etc/group and /etc/gshadow
      # gpasswd networkcare                                   // making new password for networkcare
      # gpasswd -A linuxcare networkcare               // administrator for networkcare
      # gpasswd -R networkcare                             // restrict non-members login
      # gpasswd -r networkcare                              // delete group password

$ gpasswd -a linuxcare networkcare                    // adding new member
$ gpasswd -d linuxcare networkcare                    // deleting group member

  • chgrp - Changes the group ownership of a file or directory.
      # chgrp linuxcare /home/linuxcare


So In this way group can be managed in Linux.



0 comments:

Post a Comment