How to automate batch creation of users in Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.