Get the App
SLTechnology News&Howtos  ›  Network Security  › 

How the shell script batch creates users and assigns random passwords

Shulou Source: shulou.com Published: 2022-06-01 00:33:17 10月04日 Update

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!

Tags: Passwords users scripts content articles ranges random numbers generation value interests characters boys buddies more knowledge industry information channels channels references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Apple vpn Shulou Technology Microsoft