The first method:
[Email protected] ~]# echo stu{01..10}|tr "" \ n "|sed-r ' s# (.
) #useradd \1;pass=$ ((random+10000000)), echo "$pass" |passwd--stdin \1;echo-e "\1\t echo "$pass"
" >>/tmp/oldboy.log #g ' |bash
The second method:
Echo Stu{01..10}|xargs-n1|sed-n ' s#.#useradd & \&\& Echo $RANDOM |md5sum|cut-c5-9 >>/tmp/mima.log \&\& echo "
tail -1 /tmp/mima.log|passwd --stdin &
"#gp ' |bash
The third method:
[[email protected] ~]# echo stu{3..4}: $RANDOM |tee/tmp/useradd.log|xargs-n1|awk-f ":" "{print" Useradd "$"; echo "$" |pa SSWD--stdin "$" "} ' |bash
The fourth method:
[Email protected] ~]# echo Stu{01..10}|xargs-n1|awk ' {print ' useradd ' $ ' \&\& echo $RANDOM |md5sum|cut-c4-11 &G T;>/tmp/mima.log \&\& Echo
tail -1 /tmp/mima.log
|PASSWD--stdin "$" "} ' |bash
The 5th method:
[Email protected] ~]# seq-f "oldboy%02g" 10|awk ' {print "echo" $ ">>/tmp/mima.txt \&\& useradd" $ "\& ;\& op=$ (date+%f|md5sum|cut-c1-8) \&\& echo $op |passwd--stdin "$" \&\& echo $op >>/tmp/mima. TXT "} ' |bash
The Sixth method:
Using scripts
#!/bin/bash
#This is the creation of the post-90s Liu Zhonghe at 2017-12-27 19:30
For N in
seq 3 4
Do
Useradd user$n
echo "User$n:user$n
echo user$n|md5sum|cut -c5-9
"|CHPASSWD
Done
Linux uses commands to create users in bulk