Add the appropriate user account to the Linux service and the initial password is "123456". You can specify a list file for all users, and then write a script named uadduser.sh.
[[email protected] ~]# vim/root/users.txt //Create a new list file that specifies all users
Xiaoming
Xiaoqing
Xiaofang
Xiaodong
[[email protected] ~]# vim uadduser.sh //Create a script to add users in bulk
#!/bin/bash
#2017-8-18 18:02:02
#auto by Xiaoming
userlist=$ (Cat/root/users.txt)
For UNAME in $USERLIST
Do
Useradd $UNAME
echo "123456" | passwd--stdin $UNAME
Done
[[email protected] ~]# chmod +x uadduser.sh //Give script execution permission
[[email protected] ~]# ./uadduser.sh //test script and confirm results
[Email protected] ~]# tail-4/etc/passwd
Xiaoming:x:502:502::/home/xiaoming:/bin/bash
Xiaoqing:x:503:503::/home/xiaoqing:/bin/bash
Xiaofang:x:504:504::/home/xiaofang:/bin/bash
Xiaodong:x:505:505::/home/xiaodong:/bin/bash
This article is from the "7715953" blog, please be sure to keep this source http://7725953.blog.51cto.com/7715953/1957436
Shell scripts add users in bulk