How the shell script batch creates users and assigns random passwords
This article mainly introduces how the shell script creates users in batches and assigns random passwords. It is very detailed and has a certain reference value. Friends who are interested must read it!
For n in `seq-w 10`do pass= `echo $RANDOM | md5sum | cut-c 2-9` useradd test$n echo $pass | passwd-- stdin test$n echo-e "test$n\ t$ pass" > > / tmp/user.logdone
Note:
The-w usage of seq
Generation of random numbers
Cut-c: intercepts a specified range of characters
The range of random numbers generated by $RANDOM is 0-32767
The above is all the content of the article "how shell scripts create users in batches and specify random passwords". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!