Group Management Commands in Linux - Top Learn Linux

  Creating a Group with default options :

  • To create a group the syntax is
  • #groupadd <name for the group>
  • #groupadd admingrp

Let see admingrp group created and that group id is 1012.

Creating a group with user specified group id (GID)
  • #groupadd <option> <name for the group>
  • #groupadd -g 615 admin
  • Verify it in /etc/group


Let see admin group and and user mentioned group id is 615 created .

Modifying the properties of the group :
  • To modify the group properties the syntax is
  • #groupmod <option> <arguments> <group name>
  • -g to change the group id
  • -o to override the previous assigned id, if it matches with the new one.
  • -n to change the group name
  • Changing the GID of the group
  • #groupmod –g 700 admin
  • Verify it in /etc/group

Let see the groupid is changed.

Changing the name of the group:
  • The syntax for changing the group name is
  • #groupmod –n <new name > < existing name >
  • #groupmod –n newadmin admin



Adding and Removing Members to a Group :
  • Adding the members to the group is to add users to the group. To add the members to the group the syntaxes are
  • To add single user to the group
  • #usermod –G <group name > < user name>
  • #usermod –G newadmin toplearnlinux











Adding multiple single or multiple users to the group with various attributes
  • #gpasswd < option> <arguments> <group name>
Options:
  • -M For Adding Multiple users to a group
  • -A for Adding a group Administrator
  • -a for Adding a single user to a group
  • -d removing a user from a group
  • #gpasswd –M <user>,<user>,<user> <group>
  • #gpasswd –M admin2,admin3,admin4 newadmin
















Adding a single user using gpasswd :
  • #gpasswd –a admintl newadmin 
(verify it in /etc/group)
















Making a user as a administrator:
  • #gpasswd –A admintl newadmin
(verify it in /etc/gshadow)










Removing a user from the group :
  • #gpasswd –d admin2 newadmin















Network in linux - TopLearnLinux

  Networking: It is a connection between two or more machines to communicate with each other. The basic requirements for Net...