Day03 of #90DayOfDevOps
Understanding How to Create a Group in Linux and Add Users.
🚀 Welcome to Day 03 of my 90 Days of DevOps journey!
Today, we’re diving into the fundamentals of the Linux User’s and Managing the Groups.
Firstly, we need an Linux Machine. We are using AWS Linux EC2 Instance for this using SSH we are connecting with our local machine.
Let’s dive in it,
Linux users play a key role in keeping the system secure and running smoothly. Their permissions and access control decide what they can do with files, processes, and system resources.
To create a user, use the command useradd -m user1
. This will create a user named user1 -m will ensure to create a home directory /home for user1. To set a password for the user, simply use the command passwd user1
.
To check if the user is created, use the command cat /etc/passwd
. The file /etc/passwd
is where all users are listed.
Woo, Successfully created a First User in Linux. Congratulation✅
Now lets learn about how to create a Group and add user to it.
First things first, let assume we are creating Two groups Developer and Tester.
Developer group will contain two users user1 and user2,while the Tester group will include user3.
Let's create a Developer group using the command groupadd developer
. To check if the group is created, type the command cat /etc/group
. The file /etc/group
is where all groups are listed.
Congratulations on creating your first group! 🎉 Now, let's move on to creating the Tester group. Simply use the command groupadd tester
.
Now, let's add a user to a group using the command usermod -aG tester user3
. The usermod
command is used to modify group membership. The -a
option appends the user to the specified group, and -G
specifies the group you want to add the user to.
We can add multiple users using the command gpasswd -M user1,user2 developer
.
gpasswd
This command helps manage the /etc/group
file, which stores group information, and handles group membership. -M
is the option that lets you specify the list of users. user1,user2
This is the list of users that will be added to the group. The developer group is where the user is added.
Now, let's check if all the users have been added to their specific groups by using the command cat /etc/group
.
🎉Wohoo..! We added successfully added user in the group.
By the end of this process, I gained a thorough understanding of user management, including how to create and manage groups, add users to groups, and verify group memberships. Additionally, I learned about file navigation, which involves moving through the directory structure efficiently using various commands.
Mastering Linux is a crucial step in becoming proficient in DevOps. I am excited to expand my knowledge and expertise in this field, exploring advanced topics.
Stay tuned for more insights as I continue my #90DayOfDevOps challenges. If you have any questions or tips, feel free to share them in the comments. Let’s keep learning and growing together! 🚀