As a Linux system administrator, you sometimes have to add a new user account to the system. To do this, use the AddUser command frequently. The AddUser command can become quite tedious and time-consuming when it comes to creating multiple users. This short article is intended to provide Linux system administrators with a simple and unattended way to create users in batches. The newusers command will help you create multiple users by getting information from the pre-filled file. |
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/02/225512ttvvvxslx5ze9ix9.jpg "alt=" How to automatically batch create users in Linux how to automatically batch create user "title=" in Linux how to automatically batch create user in Linux how to automatically batch create user "style=" vertical-align:middle; height:auto;margin:10px auto; "/>
Requirements
privileges to access Linux computers.
Conventions
#-The given command needs to be run as root or with the sudo command
$-the given command runs with the normal permissions of the user
How to Do
Create a file that contains a user name
First, you need to create a file that contains a list of user names.
$ VI Users-list.txt
In a file, a user row, the following is the style:
Username:Password:User id:group id:user info:home directory:default ShellUsername:Password:User id:group id:user Info: Home directory:default ShellUsername:Password:User id:group id:user info:home directory:default Shell ...
Create user
After you have created a file that contains user information, use the newusers command to create the user.
# newusers Users-list.txt
Checking user accounts
Finally you can confirm that the user was created correctly and view them in the /etc/passwd file:
# TAIL/ETC/PASSWD
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/02/225534xxrlzr7dlt74w8lj-1.png "alt = "How to automatically batch create users in Linux how to automatically batch create user" title= "in Linux how to automatically batch create user in Linux how to automatically batch create user" style= "vertical-align:middle; height:auto;margin:10px auto; "/>
How to automate batch creation of users in Linux