#! /bin/bash
A=`head -n 10 /dev/urandom|strings|awk -F" " '{print $1}'|head -n 1`
B=`head -n 10 /dev/urandom|strings|awk -F" " '{print $1}'|head -n 1`
C=`head -n 10 /dev/urandom|strings|awk -F" " '{print $1}'|head -n 1`
D=`head -n 10 /dev/urandom|strings|awk -F" " '{print $1}'|head -n 1`
E=`head -n 10 /dev/urandom|strings|awk -F" " '{print $1}'|head -n 1`
AAA=$A$B$C$D$E
MIMA=${AAA:0:12}
IP=`ifconfig|grep addr:|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
echo ""#you will change the passwd automatic#""
echo ""######please wirte the user name######""
read USERNAME
echo $MIMA |passwd --stdin $USERNAME
echo "$IP $USERNAME $MIMA" >/root/$IP.txt
无交互式改密
echo "wls!web$njcc"|passwd --stdin "weblogic"