#!/bin/bash
echo "hello world!" > ftp_userpwd_list.txt
date_str=`date '+%Y-%m-%d-%H:%M:%S'`
back_file="$date_str.proftpd.passwd"
cp /etc/proftpd.passwd $back_file
for user in $(cat /etc/proftpd.passwd | gawk -F: '{print $1}')
do
new_passwd_text="$RANDOM"
#make md5 passwd
new_passwd_md5=`echo "$new_passwd_text" | md5sum |cut -d ' ' -f1`
#save passwd text
echo "$user:$new_passwd_md5" >> ftp_userpwd_list.txt
echo "$new_passwd_md5" | ftpasswd --passwd --name=$user --change-password --stdin --md5 --file=/etc/proftpd.passwd
done
|