Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » Create Multiple Users with Passwords in Ubuntu Linux

Create Multiple Users with Passwords in Ubuntu Linux

Posted on 17/02/202204/09/2023 Imoh Etuk By Imoh Etuk No Comments on Create Multiple Users with Passwords in Ubuntu Linux
Slide1-1

As a Ubuntu Linux system administrator, there might be a time when we have several tasks to handle at the same time. Of course, being able to work within the stipulated time to enhance productivity is one of the things we always strive to achieve. In this article, we shall create Multiple Users with Passwords in Ubuntu Linux. Please see How to reset MySQL Root password, Windows 10 Administrative Shortcut command key, and Active Directory Administrative Tools shortcut.

When it comes to Linux, there are different levels of users with each having its own level of permission and we create these users for different purposes. You can read the following related topics that also talk about Linux:

  1. How to Create Symbolic Links in Linux
  2. How to Install Terraform on Linux
  3. How to install MariaDB on Ubuntu
  4. How to Configure Advanced PAM in Linux
  5. Locate, Find, and Grep: How to search for files and patterns in Linux/Unix-like OS

Sometimes we are tasked with creating more than one or multiple users at the same time. We can’t start creating the users one by one when tasked set before us is to be accomplished within a limited time.

Hence, this short guide is aimed at showing you how to create multiple users at the same time and set a password for each one of them on an Ubuntu Linux system.

Before we move on let’s discuss the types of users we have available in Linux. Please see How to block the Change Password Feature for All Users via the Exchange Administrative Center, and Change your root password: How to enable and disable the root user on your macOS.

Type of Users in Ubuntu Linux

Linux being a multi-user OS that is based on the Unix concepts of file ownership and permissions to provide security at the file system level has two types of users that’s;  root users (system users),  regular users, and service users.

Administrative Root Users

Primarily, Linux administrative root account is automatically created when you install Linux, and it has administrative privileges for all services on Linux OS. The root account is also known as superuser. The root user or superuser also has the ability to override any file ownership and permission restrictions.

In real-time scenarios, this means that the superuser has the right to access anything on its own server. This user is used to make system-wide changes and must be kept secure. It is also possible to configure other user accounts with the ability to assume “superuser rights”.

In fact, creating a normal Ubuntu Linux user that has sudo privileges for system administration tasks is considered the best practice.

Regular Users

Regular users have the necessary privileges to perform standard tasks on a Linux OS such as running word processors, databases, and Web browsers.

They can store files in their own home directories. Since regular users do not normally have administrative privileges, they cannot accidentally delete critical operating system configuration files. Hence, the need to apply caution before using the sudo (superuser do) command.

Service Users

Services such as Apache, Docker, Kubernetes, Squid, mail, games, and printing have their own individual service accounts. These Ubuntu Linux accounts exist to allow each of these services to interact with your computer.

The list of users can be found in the /etc/passwd or awk -F':' '{print $1}' /etc/passwd while /etc/gshadow is used to store users’ passwords.

Linux Ubuntu
Ubuntu OS
Users and Passwords in Linux

To understand it better, there are two standard users in Linux that is; system users and regular users. From the above, the administrative user or super user or root user, and service users are under system users created by default immediately the Liinux OS is set up while the regular users are created by the system administrator

Having introduced briefly the types of users available in Ubuntu Linux, let’s go over to the main task of the day which is creating multiple users at the same time and setting passwords for each of them.

Create Multiple Ubuntu Linux Users

To create multiple users at the same time we will use the following step.

Step 1: Create a directory and list down the names of users you which to create in it by running touch /opt/useradd. In the screenshot below, we created the/opt/useradd, used vim /opt/useradd to edit and add the names of the Ubuntu Linux users we want to add as admin1, admin2, admin3, admin4 and admin5 respectively. Of course, the /opt/ directory is a reserved directory so it’s read-only.

While writing down the list of users in Vim editor you can’t write to it using the normal :wq! command but :w !sudo tee % command as shown in the screenshot below.

Ubuntu Distribution
Ubuntu Operating System

To be sure the names have been written and saved, let’s view the /opt/useradd directory by typing cat /opt/useradd

Ubuntu OS
List of Users

Step 2: As the next step, let’s run ‘for loop’ as shown below to create the users

Linux Ubuntu
Run for loop to add the Users

Step 3: Run the command below to view the list of newly added users and respective IDs. Not each user in Linux is mapped to a unique ID when created.

for i in `cat /opt/useradd` ; do sudo useradd $1 ; done 
View-the-list-of-newly-aded-users-1
View the list of Users
Note this awk -F':' '{print $1}' /etc/passwd of cat /etc/passwd command can also be used to view the list of user accounts  

Set Passwords for Multiple Ubuntu Linux User Accounts

We are done with creating multiple users at the same time. From the above we have created 5 users at the same time, now it’s time to secure their accounts by setting passwords for each of the accounts.

 To set different passwords to each user, interactively run the below command

for i in `cat /opt/useradd` ; do sudo passwd $i ; done
Set-Password-for-each-users
Set Password for each User

We have successfully updated passwords for all the users we created. You can go ahead and switch users using the su username command. For example, let’s switch users to one of the users we just created.

Let’s sayadmin1 that’s su admin1 and use the whoami command to confirm that it’s admin1 account.

Switch-User
Switch User in Linux

That’s all. In this post we have learned about different types of users in Linux, creating multiple user accounts and setting passwords for each of them at the same time.

I hope you found this blog post helpful on how to create Multiple Users with Passwords in Ubuntu Linux. Please let me know in the comment section if you have any questions.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:Ubunt 20.04 LTS, Ubuntu, Ubuntu 20.04 LTS, User Account, users

Post navigation

Previous Post: Fix for security vulnerabilities in the BIOS firmware for some Intel Processors
Next Post: SU Authentication Fix: Sudo Permission Denied in Ubuntu

Related Posts

  • Package1
    Install Synaptic Package Manager: Handle packages in Ubuntu Linux
  • download
    Remove Packages from a Linux: Quick Guide Linux
  • Install Packages to Amazon Virtual Machine Using Terraform
    How to Install Packages to Amazon VM using Terraform AWS/Azure/OpenShift
  • openstack ola
    Openstack Deployment with Devstack Linux
  • PersonalHow to Create Symbolic Links in Linux
    All You Need to Know About Symbolic Links in Linux Linux
  • Screenshot 2022 03 21 at 18.06.30
    How to Configure Virtual Host for Apache HTTP Web Server to Host Several Domains on Ubuntu 20.04 LTS Linux

More Related Articles

Package1 Install Synaptic Package Manager: Handle packages in Ubuntu Linux
download Remove Packages from a Linux: Quick Guide Linux
Install Packages to Amazon Virtual Machine Using Terraform How to Install Packages to Amazon VM using Terraform AWS/Azure/OpenShift
openstack ola Openstack Deployment with Devstack Linux
PersonalHow to Create Symbolic Links in Linux All You Need to Know About Symbolic Links in Linux Linux
Screenshot 2022 03 21 at 18.06.30 How to Configure Virtual Host for Apache HTTP Web Server to Host Several Domains on Ubuntu 20.04 LTS Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • powershell
    Set PowerShell Execution Policy via Windows Settings Windows
  • image 41
    How to Quickly Fix Windows Search Bar Not Working Windows
  • Hyper V Virtual Switch Copy
    How to Create VDI Collections on Windows Server 2022 Network | Monitoring
  • annoying startup apps
    Stop an application from starting up automatically on macOS Mac
  • Screenshot 2021 04 03 at 18.30.29
    Setup Windows server backup and create backup jobs with Bare metal backup Backup
  • Integrate Icloud With Windows
    Synchronize Apple Calendar on Windows with Outlook [Part 2] Mac
  • Veeam Virtual Appliance for Backup and Restore
    How to setup Veeam Software Appliance v13 Backup
  • gpmc 1
    How to Install Group Policy Management Console on Windows 11 Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,825 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.