How to automatically create users in batches in Linux
Dec 28, 2023 pm 08:11 PMIntroduction | As a Linux system administrator, you sometimes have to add new user accounts to the system. For this purpose, the adduser command is often used. When it comes to the creation of multiple users, the adduser command can become quite boring and time-consuming. This short article aims 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 pre-populated files. |
Privileges to access Linux computers.
Promise# - The given command needs to be run with root user privileges or using sudocommand
$ - The given command is run as a user with regular permissions
how to proceed Create a file containing usernameFirst, you need to create a file containing a list of usernames.
$ vi users-list.txt
In the file, one user per line, the following is the style:
Username:Password:User ID:Group ID:User Info:Home Directory:Default Shell Username:Password:User ID:Group ID:User Info:Home Directory:Default Shell Username:Password:User ID:Group ID:User Info:Home Directory:Default Shell ...
After creating the file containing user information, use the newusers command to create the user.
# newusers users-list.txt
Finally you can confirm that the users have been created correctly by viewing them in the /etc/passwd file:
# tail /etc/passwd
The above is the detailed content of How to automatically create users in batches in Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

deepseek web version entrance deepseek official website entrance

Android TV Box gets unofficial Ubuntu 24.04 upgrade

BitPie Bitpie wallet app download address

BITGet official website installation (2025 beginner's guide)

Zabbix 3.4 Source code compilation installation

Detailed explanation: Shell script variable judgment parameter command

Ouyi okx installation package is directly included
