The for Ubuntu 8.04LTS und Ubuntu 10.04LTS modified Skript for "userdb"-Creation is:
Code:
#!/bin/bash
# http://www.howtoforge.com/forums/showthread.php?t=7881&highlight=mailuser
delim="_"
OIFS=$IFS
IFS="
"
rm -rf /etc/courier/userdb
touch /etc/courier/userdb
chmod 600 /etc/courier/userdb
for line in `/usr/sbin/pw2userdb | grep -ir home=/var/www/web`
do
full=$( echo $line )
domain=$( echo $line | cut -d"$delim" -f1 )
remain=$( echo $line | cut -d"$delim" -f2,3,4 )
username=$(echo $remain | cut -d " " -f1 ) # tab inside
remain2=$(echo $remain | cut -d " " -f2 ) # tab inside
uid=$( echo $remain2 | cut -d '|' -f1 )
gid=$( echo $remain2 | cut -d '|' -f2 )
home=$( echo $remain2 | cut -d '|' -f3 )
shell=$( echo $remain2 | cut -d '|' -f4 )
password=$( echo $remain2 | cut -d '|' -f5)
echo "$username@$domain $uid|$gid|$home|$shell|$password|/var/www/www.$domain/user/${domain}_$username/Maildir" >> /etc/courier/userdb
/usr/sbin/makeuserdb
done
IFS=$OIFS
The content in /etc/courier/userdb is:
Code:
user1@domain.de uid=10014|gid=10006|home=/var/www/web6|shell=/bin/false|systempw=$1$CwvHHL@}$vLvpPKT6FN1Nxa1E5hDDC0|/var/www/www.domain.de/user/domain.de_werner/Maildir
user1@domain.us uid=10013|gid=10003|home=/var/www/web3|shell=/bin/false|systempw=$1$QJqPJviI$JU3UO4bOF.vL7CotHntuh1|/var/www/www.domain.us/user/domain.us_michael/Maildir
But the login does not work! What is wrong in the generated userdb-file?