You'd need a file "list.txt" with the list of IPs and "oldpass.txt" file with the current password. You can just set a cronjob to do reset password on a regular basis (every 25 days for example).
#!/bin/bash
# Generate random new password 24 characters long
newpass=`mkpasswd -l 30 -d 3 -C 5 -s 3`
# Get old password from oldpass file
oldpass=`cat oldpass.txt`
echo Old: $oldpass
echo New: $newpass
# ssh to server and reset password
for server in `cat list.txt`
do
echo "Changing $server"
ssh -t $server 'passwd <<EOF
'$oldpass'
'$newpass'
'$newpass'
EOF'
done
No comments:
Post a Comment