Step by step approach of Linux task on creating a group by the KodeKloud Engineer Program:
Table of contents
- 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
- Step 2: Switch to Root User
- Step 3: Verify user existence
- Step 4: Verify group existence
- Step 5: Create group nautilus_noc
- Step 6: Create user stark
- Step 7: Check groups associated with user stark
- Step 8: Add user stark to nautilus_noc group
- Congratulations!! you've successfully completed this task!!!
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
SSH into App Server : Replace
username
with your user name on App Server andapp_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
Root access is required for elevated privileges to execute sensitive commands.
sudo su -
(Enter your password )
Step 3: Verify user existence
Using below command we can verify user stark existence.
id stark
Step 4: Verify group existence
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
.
- If the group
Step 5: Create group nautilus_noc
Using below command we can create group
nautilus_noc
.groupadd nautilus_noc
Verify group existence by performing Step 4 again.
Step 6: Create user stark
Using below command we can create user stark.
useradd -m stark
Verify user existence by performing Step 3 again.
Step 7: Check groups associated with user stark
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
Using below command we can add user stark to nautilus_noc group.
usermod -aG nautilus_noc stark
The -a flag stands for -append while -G flag stands for -group, combining both we can add a user to a particular group.
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!!!