How to Create Multiple Users in Linux?

I'm AWS Certified Solution Architect. I do write about the AWS Cloud Operation, Migration, Security and Automations.
Search for a command to run...

I'm AWS Certified Solution Architect. I do write about the AWS Cloud Operation, Migration, Security and Automations.
I am hiring linux writers for my blogs. Please let me know if you are interested. https://www.linkedin.com/in/dhananjay-kulkarni-ba54a81b0/
Sorry for the late response, I would love to have a follow-up and learn more regarding this role.
Thank you.
Introduction: Migrating physical or virtual machines from on-premises to AWS can feel scary but AWS Application Migration Service (MGN) makes it straightforward by continuously replicating servers to AWS and enabling test launches and cutovers with m...

Migrating your on-premises MySQL database to Amazon RDS for MySQL with AWS Database Migration Service (DMS) is a common way to move to a managed, highly available database while keeping zero downtime or minimal. In this blog, I’ll show how you can mi...

Introduction: Monitoring storage utilization is critical to ensure application stability and avoid unexpected outages. In AWS, Amazon EBS does not provide built-in metrics for volume-level disk usage, which makes proactive alerting a challenge. To ad...

Introduction: we need to securely transfer sensitive documents to the cloud without manual intervention. A common requirement is to automatically detect file changes, apply client-side encryption, and upload only the modified files on a scheduled bas...

Introduction: Data migration and disaster recovery are key considerations for building resilient cloud architectures. A common requirement is to migrate data from an local machine to a primary Amazon S3 bucket, while ensuring that the same objects ar...

When working within complex systems such as within large-scale computer networks or IT operations involving multiple applications or software running simultaneously under different user's control. so, Linux OS offers to create multiple users for your system at once.
Step 1: Open the Linux terminal
Step 2: Create .txt file to write the new user's credentials
nano new_users.txt
step 3: Type your desired multiple-user information in syntax below.
user_name:user_password:Uid:Gid:comment:home_dir:def_shell

here, User_name: user name of the new user to be created
user_password: password for the new user
Uid: New user's ID
Gid: New user's group ID
comment: Comment section or User Full Name
home_dir: User's home directory
def_shell: User's default shell
Step 4: change the .txt file's permissions using the following command
sudo chmod 600 new_users.txt
Step 5: Input the password of the currently logged in user.
Step 6: Create desired users by typing the command bleow and press Enter.
sudo newusers new_users.txt
Step 7: Now, check if the desired users are created.
tail /etc/passwd
Step 1: Open the terminal or Press CTRL + ALT + T
Step 2: Create a directory name bin in your home directory
mkdir bin
Step 3: After that , Create a bash Script file inside the bin directory
nano bin/create_users.sh

Step 4: Now, write the following script in the create_users.sh file for creating multiple users in a loop.
#!/bin/bash
read -p "Enter number of Users to create:" num
echo "------------------------------------------------------"
for (( i=1; i<=$num; i=i+1)); do
read -p "Enter Username no.$i: " uname
sudo useradd $uname
read -p "Enter password for user no.$i? [Y/N] " flag
if [[ "$flag" == "Y" || "$flag" == "y" ]]; then
sudo passwd $uname
echo "Successfully created New User: $uname with password."
echo "------------------------------------------------------"
else
echo "Successfully created New User: $uname without password."
echo "------------------------------------------------------"
fi
done
Step 5: To save and Exit from the Script, press CTRL + S and CTRL + X respectively
Step 6: Now, type the following command to permit the current user in your system.
chmod u+rwx bin/create_users.sh
Step 7: Finally restart your system to add the newly created bin directory to the $PATH variable
sudo reboot
Step 8: Now open your terminal or Press CTRL + ALT + T
Step 9: Run the previously written script by typing the file name.
create_users.sh

Step 10: After entering the data, to check if the desired number of users is created.
tail /etc/passwd

Step 1: Open the Terminal
Step 2: Type the following command
sudo groupadd Student
sudo gpasswd -M UserA,UserB,UserC Group_Name

Step 3: To Check the Group Members
sudo less /etc/group| grep "Group_Name"
or
sudo grep Student /etc/group

As you can see that the users are inside the group named Student.
That's all for now, Happy Coding!!!.