方法1:
使用((RANDOM+10000000))生成随机密码
echo stuo{01..3}|tr " " "\n"|sed -r ‘s#(.*)#useradd \1 ; pass=$((RANDOM+10000000)); echo $pass|passwd --stdin \1;echo \1 $pass >>/tmp/oldboy.log#g‘|bash
方法2:[[email protected] ~]# echo yuyi{01..3}|xargs -n1|sed -r ‘s#(.*)#useradd \1;pass=
date +%N|md5sum|head -c8;echo $pass|passwd --stdin \1;echo \1 $pass >>/root/kobe1.txt#g‘|bash
方法3:[[email protected] ~]# echo yuyi{01..3}|xargs -n1|sed ‘s#.*#useradd &;pass=
date +%N|md5sum|head -c8;echo $pass|passwd --stdin &;echo & $pass >>/root/kobe1.txt#g‘|bash
方法4:
[[email protected] ~]# echo BB{01..3}|xargs -n1|awk ‘{print "useradd",$1";pass=
date +%N|md5sum|head -c8;echo $pass|passwd --stdin "$1";echo "$1" $pass >>/root/kobe2.txt"}‘|bash
总结不容易,希望大家关注本人,并点赞,感谢,感谢,再次感谢!
原文地址:https://blog.51cto.com/xiyuxingxia/2384796
时间: 2024-10-08 14:49:28