Jul 052010
 

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:

newusers myuserlist.txt

After command is issued, check the results in the following files:

/etc/passwd
/etc/shadow
/etc/groups

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)