Group of Linux

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you will be using the usermod, groupadd, and groupdel commands to manage user groups in a Linux environment.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) shell(("`Shell`")) -.-> shell/VariableHandlingGroup(["`Variable Handling`"]) shell(("`Shell`")) -.-> shell/AdvancedScriptingConceptsGroup(["`Advanced Scripting Concepts`"]) linux/UserandGroupManagementGroup -.-> linux/groups("`Group Displaying`") linux/UserandGroupManagementGroup -.-> linux/groupadd("`Group Adding`") linux/UserandGroupManagementGroup -.-> linux/groupdel("`Group Removing`") linux/UserandGroupManagementGroup -.-> linux/userdel("`User Removing`") linux/UserandGroupManagementGroup -.-> linux/usermod("`User Modifying`") shell/VariableHandlingGroup -.-> shell/variables_decl("`Variable Declaration`") shell/AdvancedScriptingConceptsGroup -.-> shell/subshells("`Subshells and Command Groups`") subgraph Lab Skills linux/groups -.-> lab-8266{{"`Group of Linux`"}} linux/groupadd -.-> lab-8266{{"`Group of Linux`"}} linux/groupdel -.-> lab-8266{{"`Group of Linux`"}} linux/userdel -.-> lab-8266{{"`Group of Linux`"}} linux/usermod -.-> lab-8266{{"`Group of Linux`"}} shell/variables_decl -.-> lab-8266{{"`Group of Linux`"}} shell/subshells -.-> lab-8266{{"`Group of Linux`"}} end

Creating a New User Group

One of the most important tasks for a Linux administrator is to manage user groups. By creating groups, you can assign permissions and privileges to multiple users at once. In this step, you will learn how to create a new user group.

Target

Your task is to create a new user group called sales.

Result Example

You can use the getent group sales command to check if it was created successfully.

sales:x:1001:

Requirements

  • You must have administrative privileges to create a new group.
  • If the group already exists, the command will display an error message.

Adding Users to a Group

Once you have created a new user group, the next step is to add users to the group. By doing this, you can grant permissions and privileges to multiple users at once. In this step, you will learn how to add users to a user group.

Target

Your task is to add two users, john and jane, to the sales group.

Result Example

uid=1007(john) gid=1009(john) groups=1009(john),1008(sales)
uid=1008(jane) gid=1010(jane) groups=1010(jane),1008(sales)

Requirements

  • You must have administrative privileges to add users to a group.
  • The users must already exist on the system.

Deleting a User Group

Sometimes, you may need to delete a user group that is no longer needed. In this step, you will learn how to delete a user group.

Target

Your task is to delete the sales group.

Requirements

  • You must have administrative privileges to delete a group.
  • If there are any users still assigned to the group, the command will display an error message. You must remove all users from the group before deleting it.

Summary

Congratulations! You have successfully completed the Group of Linux on managing user groups using the usermod, groupadd, and groupdel commands. These commands are essential for managing permissions and privileges on a Linux system. Keep practicing and exploring the various commands and options available to become proficient in Linux administration.

Other Linux Tutorials you may like