As usual, the main source for writing articles here is a need I had and a solution I found 😉
This time the need was to add a series of users in a Linux system without repeating the command useradd one zirillion of times.
First, we need to populate a text files with details about the users we’re going to create.
Let’s assume the file is called myuserlist.txt (permissions 600) with the following syntax:
user1:password1:1001:510:My First Account:/home/user1:/bin/bash
user2:password2:1002:510:My Second Account:/home/user2:/bin/bash
user3:password3:1003:510:My Third Account:/home/user3:/bin/bash
user4:password4:1004:510:My Fourth Account:/home/user4:/bin/bash
Once you’re done with the list, proceed to add the users with the command:
After command is issued, check the results in the following files: