本文共 710 字,大约阅读时间需要 2 分钟。
#!/bin/bash
name=hostname
MATRIX1="0123456789"
MATRIX2="ABCDEFGHIJKLMNOPQRSTUVWXYZ"MATRIX3="abcdefghijklmnopqrstuvwxyz"MATRIX4="./*&^%$#@!()"LENGTH="16"
ii=1
while [ "${n:=1}" -le "$LENGTH" ]; doMATRIX=eval echo "$"MATRIX${ii}
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"let n+=1ii=expr $ii + 1
if [ $ii -eq 5 ];thenii=1fidoneecho "$PASS" | passwd root --stdinecho "$ETH1 $ETH0 $name root $PASS" >> /tmp/pass.txtcat /tmp/pass.txtrm -rf /tmp/pass.txt rm -rf /root/test.sh 转载于:https://blog.51cto.com/myunix/2056013