天天看点

shell 批量修改密码

批量修改密码,32位大小写+数字+特殊符号。

#!/bin/bash

hosts=(xxx.xxx.xxx.xxx)

#passwd=`</dev/urandom tr -dc A-Za-z0-9_%#^! | head -c32`

#echo $passwd

mv pwfile pwfile.orig

#hosts=(`cat all.host`)

for i in ${hosts[@]}

do

passwd=`</dev/urandom tr -dc A-Za-z0-9_%@! | head -c32`

echo "root@$i $passwd" >> pwfile