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:

  • ftp ftp command examples Both ftp and secure ftp (sftp) has similar commands. To connect to a remote server and download multiple files, do the following. $ ftp IP/hostname ftp> mget *.html To view the file names … Read More
  • free   free command examples This command is used to display the free, used, swap memory available in the system. Typical free command output. The output is displayed in bytes. $ free     &n… Read More
  • grep   grep command examples Search for a given string in a file (case in-sensitive search). $ grep -i "the" demo_file Print the matched line, along with the 3 lines after it. $ grep -A 3 -i "example" demo_te… Read More
  • gzip   gzip command examples   To create a *.gz compressed file: $ gzip test.txt To uncompress a *.gz file: $ gzip -d test.txt.gz Display compression ratio of the compressed file using gzip -l $ … Read More
  • find find command examples Find files using file-name ( case in-sensitve find) # find -iname "MyCProgram.c" Execute commands on files found by the find command $ find -iname "MyCProgram.c" -exec md5sum {} \; … Read More

0 comments:

Post a Comment