Linux uses commands to create users in bulk

Source: Internet
Author: User
Tags stdin

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" $ "\&amp ;\& 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

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.