#!/bin/bash
# Little script to dump all passwords with the respective vpasswd auto generated command to recreate on another server
# Script writte by: hip0
# http://www.pc-freak.net
# Licensed Under GNU GPL v3
# Creation date: 15.10.2011
arg0="$0";
for f in $(echo *); do
if [ "$f" != "$arg0" ]; then
#echo cd $f;
for i in $(ls -1 $f|grep -v vpasswd); do
passwd=$(/home/vpopmail/bin/vuserinfo $i@$f | grep 'clear passwd' | awk '{ print $3 }');
echo /home/vpopmail/bin/vpasswd "$i"@"$f" "$passwd";
done
fi
done

