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
  • win 10 login screen
    How to Transfer User Profile to another User in Windows Windows
  • How to create edit save exit file
    Mastering Vim in Linux: How to Create, Edit, Save, and Quit Files Linux
  • WhatsApp Image 2022 02 20 at 4
    How to use Postman for your POST Request Web Server
  • Featured image 4
    Focus on Tasks: Limit Distraction & Get Things Done on Windows Windows
  • OpenSSL on Windows
    How to Install OpenSSL on Windows Computers Windows
  • Auto Update Upgrade issues
    Fix Microsoft Office Showing “Upgrade Required” in AutoUpdate JIRA|Confluence|Apps
  • ycx
    Detect registry keys using Process Monitor using Sysinternals Tools Windows Server
  • Remote Desktop 2 1
    How to install RDS via Quick Start Deployment: Install, Publish, Update, and Uninstall Remote Desktop Web Client Web Server

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 Pocket (Opens in new window) Pocket
  • 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

  • zabbix
    Monitoring services using Zabbix Linux
  • FimageUbuntuUpgrade
    How to Upgrade From Ubuntu 20.04 LTS to 22.04 LTS Linux
  • SU
    How to switch users in Linux Linux
  • etcconf
    How to configure user resource limits and restrictions in Linux Linux
  • featuredpkg
    How to solve /var/lib/dpkg/lock Error in Ubuntu Linux Linux
  • nodejs install on ubuntu
    How to install Node.js on Ubuntu Linux

More Related Articles

zabbix Monitoring services using Zabbix Linux
FimageUbuntuUpgrade How to Upgrade From Ubuntu 20.04 LTS to 22.04 LTS Linux
SU How to switch users in Linux Linux
etcconf How to configure user resource limits and restrictions in Linux Linux
featuredpkg How to solve /var/lib/dpkg/lock Error in Ubuntu Linux Linux
nodejs install on ubuntu How to install Node.js on Ubuntu 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

  • win 10 login screen
    How to Transfer User Profile to another User in Windows Windows
  • How to create edit save exit file
    Mastering Vim in Linux: How to Create, Edit, Save, and Quit Files Linux
  • WhatsApp Image 2022 02 20 at 4
    How to use Postman for your POST Request Web Server
  • Featured image 4
    Focus on Tasks: Limit Distraction & Get Things Done on Windows Windows
  • OpenSSL on Windows
    How to Install OpenSSL on Windows Computers Windows
  • Auto Update Upgrade issues
    Fix Microsoft Office Showing “Upgrade Required” in AutoUpdate JIRA|Confluence|Apps
  • ycx
    Detect registry keys using Process Monitor using Sysinternals Tools Windows Server
  • Remote Desktop 2 1
    How to install RDS via Quick Start Deployment: Install, Publish, Update, and Uninstall Remote Desktop Web Client Web Server

Subscribe to Blog via Email

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

Join 1,832 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.