shell 随机修改密码

前端之家收集整理的这篇文章主要介绍了shell 随机修改密码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

#!/bin/bash@H_502_1@

name=hostname ETH1="" if ifconfig eth1 &> /dev/null;then ETH1=$(ip a | grep -A 0 "eth1" | awk -F "[ /]" '/inet/ {print $3}') fi ETH0=$(ip a | grep -A 0 "eth0" | awk -F "[ /]" '/inet/ {print $3}')@H_502_1@

MATRIX1="0123456789" MATRIX2="ABCDEFGHIJKLMNOPQRSTUVWXYZ" MATRIX3="abcdefghijklmnopqrstuvwxyz" MATRIX4="./*&^%$#@!()"@H_502_1@

LENGTH="16"@H_502_1@

ii=1 while [ "${n:=1}" -le "$LENGTH" ]; do MATRIX=eval echo "$"MATRIX${ii} PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}" let n+=1 ii=expr $ii + 1 if [ $ii -eq 5 ];then ii=1 fi done echo "$PASS" | passwd root --stdin echo "$ETH1 $ETH0 $name root $PASS" >> /tmp/pass.txt cat /tmp/pass.txt rm -rf /tmp/pass.txt rm -rf /root/test.sh@H_502_1@

猜你在找的Bash相关文章