How to Create Multiple User Accounts in Linux

The two utilities for adding or creating user accounts in Unix/Linux systems are adduser and useradd. These commands are designed to add a single user account in the system at a time. What if you have multiple users accounts to be created? That’s when you need a program such as newusers.

Newusers is a useful command line utility used to update and create new user accounts at a single time. It is intended to be used in IT environments with large systems where a system administrator needed to update or create multiple user accounts in batch. It reads information from stdin (by default) or a file to update a set of existing user accounts or to create new users.

In this article, we will explain how to create multiple user accounts in batch mode using Newusers utility in Linux systems.

To create users in a batch, you can provide their information in a file in the following format, same as the standard password file:



  • pw_name: username
  • pw_passwd: user’s password
  • pw_uid: user’s ID
  • pw_gid: user’s group ID
  • pw_gecos: defines comments sections.
  • pw_dir: defines the home directory of the user.
  • pw_shell: defines user’s default shell.

Attention: You should protect the input file since it contains unencrypted passwords, by setting the appropriate permissions on it. It should only be readable and writable by root.

For example, to add the user accounts ravi and tecmint, you can create a files called users.txt as shown.

$ sudo vim users.txt 

Next, add the user accounts details in the file in the following format.

ravi:213254lost:1002:1002:Tecmint Admin:/home/ravi:/bin/bash
Create Multiple User Accounts in Linux

Create Multiple User Accounts in Linux

Save the file and set the required permissions on it.

$ sudo chmod 0600 users.txt 

Now run the newusers command with the input file to add the above user accounts at once.

$ sudo newusers users.txt

First, newusers program tries to create or update the specified accounts, and then write these changes to the user or group databases. In case of any errors except in the final writes to the databases, no changes are committed to the databases. This is simply how the newusers command works.

If the previous command is successful, check the /etc/passwd and /etc/groups files to confirm that the user accounts have been added as shown.

$ cat /etc/passwd | grep -E "ravi|tecmint"
Verify User Accounts in Linux

Verify User Accounts in Linux

For more information, see the newuser man page.

$ man newuser 

You might also like to check these following related articles.

  1. 3 Ways to Change a Users Default Shell in Linux
  2. How to Create a Shared Directory for All Users in Linux
  3. Whowatch – Monitor Linux Users and Processes in Real Time
  4. How to Send a Message to Logged Users in Linux

In this article, we’ve explained how to create multiple users in Linux using newusers program. Use the feedback form below to ask any questions or share your comments with us. If you know of any similar utilities out there, let us know as well.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.