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.



Related Posts:

  • locate   locate command examples Using locate command you can quickly search for the location of a specific file (or group of files). Locate command uses the database created by updatedb. The example below shows all f… Read More
  • ls ls command examples Display filesize in human readable format (e.g. KB, MB etc.,) $ ls -lh -rw-r----- 1 linxcare team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz Order Files Based on Last Modified Time (In Reverse Ord… Read More
  • mkdir   mkdir command examples Following example creates a directory called temp under your home directory. $ mkdir ~/temp Create nested directories using one mkdir command. If any of these directories exist already… Read More
  • mount   mount command examples To mount a file system, you should first create a directory and mount it as shown below. # mkdir /u01 # mount /dev/sdb1 /u01 You can also add this to the fstab for automatic mount… Read More
  • mv mv command examples Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it. $ mv -i file1 file2 Note: mv -f is just the opposite, which will overwrite file2 without prompting… Read More

0 comments:

Post a Comment