#!/bin/bash
for i in {1..5}
do
        pass=`cat /dev/urandom |head -n 1|md5sum |head -c 5`
        echo "user$i:$pass" >>tmp.txt
        useradd user$i

done

chpasswd </root/tmp.txt



重点说一下 chpasswd  命令 ,读取文件格式  user:password