Step by step approach of Linux task on creating a group by the KodeKloud Engineer Program:

a. Create a group named nautilus_noc in all App servers in Stratos Datacenter.

b. Add the user stark to nautilus_noc group in all App servers. (create the user if doesn't exist).

Checkout the video of this task on: https://youtu.be/2Gn3xznYp48?si=J2VV0UN9XhtKTZC5

NOTE: To complete this task, we need to SSH into all the App servers in Stratos Datacenter and perform the below steps on all the App servers for successful completion of the task.

Step 1: Connect to App Server

  1. SSH into App Server : Replace username with your user name on App Server and app_server_ip with the server's IP address or hostname.

     sudo ssh username@app_server_ip
    

    Enter your password to proceed.

Step 2: Switch to Root User

  1. Root access is required for elevated privileges to execute sensitive commands.

     sudo su -
    

    (Enter your password )

Step 3: Verify user existence

  1. Using below command we can verify user stark existence.

     id stark
    

Step 4: Verify group existence

  1. Using below command we can verify group nautilus_noc existence.

     grep nautilus_noc /etc/group
    
    • If the group nautilus_noc exists, it would have an entry under /etc/group .

Step 5: Create group nautilus_noc

  1. Using below command we can create groupnautilus_noc .

     groupadd nautilus_noc
    
  2. Verify group existence by performing Step 4 again.

Step 6: Create user stark

  1. Using below command we can create user stark.

     useradd -m stark
    
  2. Verify user existence by performing Step 3 again.

Step 7: Check groups associated with user stark

  1. The below command returns the groups user stark is associated with, when we create a user by default a group is created with group_name same as username and group_id (GID) same as user_id (UID) .

     groups stark
    

Step 8: Add user stark to nautilus_noc group

  1. Using below command we can add user stark to nautilus_noc group.

     usermod -aG nautilus_noc stark
    
  2. The -a flag stands for -append while -G flag stands for -group, combining both we can add a user to a particular group.

  3. Verify if the user stark has been successfully added to the group nautilus_noc by performing Step 7 again.

    Congratulations!! you've successfully completed this task!!!

3
Subscribe to my newsletter

Read articles from Mohammad Abubaker directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohammad Abubaker
Mohammad Abubaker

Software engineer who wants to give back to community by sharing his learnings in the field of DevOps and surrounding technologies.