The first method:
Using Shell to create users in bulk, divided into 2:1, batch-created user names are irregular; 2. batch-created user names are regular
First, the shell of the user name that was created in bulk is irregular:
First, the user names that need to be created in bulk are listed in a text document, such as the UserList file
Then the password matching the user name is listed in another text document, such as the passwd file
The contents of both text documents are as follows:
Here is the shell script I wrote. As shown
Note that you need to import the user name that we wrote in UserList and the password entry that matches the user name written in passwd
Note:
CHPASSWD command
#以root的身份执行/USR/SBIN/CHPASSWD,CHPASSWD writes a password that has been compiled/USR/BIN/PASSWD command to the/etc/passwd password bar
Pwconv command
After #确定密码经密码写入 the/etc/passwd password bar, execute the command/usr/sbin/pwconv command to compile the password to shadow password and write the result to/etc/shadow
Give this shell script permission to X, and here I am 700.
The command is: #chmod 700/root/desktop/user/create.sh
Then execute this shell script
The command is: #./create,sh
The effect is as follows:
Ok,success
To demonstrate the second shell, I also wrote a shell script to delete the user in bulk, removing the user from the above, as shown in:
Ok
Second, I would say that the batch creation of user names is a regular time
Here, there is no need to use the above mentioned text document, so troublesome, directly written into the shell can
Yes, success.
Batch Create user (Shell command) under Linux