If you’re using cPanel 11.24+ you might find that the files under /etc/vmail folder vanishes at times. Horde and other webmail authentication issues are caused due to this bug. This folder content is required even for email account verification. I wrote a small script to regenerate the files as /scripts/updateuserdomains script failed to create the same.
This script create uid.domainname.com, gid.domainname.com, vhost.domainname.com passwd.domainname.com and shadow.domainname.com files for each domain which is hosted on the server.
#/bin/shfor i in `ls -l /home | awk ‘{print $9}’`
do
if [ -d /home/$i ]
then
for j in `ls -ld /home/$i/etc/* | awk ‘{print $9}’`
do
if [ -d $j ];
then
echo $j;
g=`echo $j | awk -F\/ ‘{print $5}’`
echo $g;
uid=`grep $g /etc/userdomains | awk ‘{print $2}’`
id -u $uid > /etc/vmail/uid.$g;
id -g $uid > /etc/vmail/gid.$g;
echo ""> /etc/vmail/vhost.$g;
ln -s $j/passwd /etc/vmail/passwd.$g
ln -s $j/shadow /etc/vmail/shadow.$gfi
done
fi
done



