second domains under an account cannot make mailboxes or forwarders

soulshepard

Verified User
Joined
Feb 7, 2008
Messages
123
Dear all,

I have the following: (from an admin point of view, under an reseller account and with the latest upated DA on freebsd)

- When i create two domains under one user account (created under a reseller)
Then i cannot create mailboxes or forwarders under the second domain.

i see under the mailboxes menu and forwarders menu

"Cannot open the user alias file for reading"

when i try to create one i get the following error

"Unable to write to the alias file. Let your administrator know that /etc/virtual/(seconddnsnameofuser)/aliases is unwritable."

now when i look into /etc/virtual/ i see the directories are missing and are also not in the /etc/virtual/domains and or /etc/virtual/domainowners

now i think i can manage to create all by hand.. BUT i guess this should not be the case no?

in other words why is the second domain name not added.? i tried to look for reference in the error logs but did not find any so far.

any help is highly appriciated.

with kind regards,

Soul
:confused:
 
Many of our accounts have multiple domains, and they have their own email addresses.

Is this something just started happening on a system where it worked before?

Anyone else having this problem?

Perhaps you should contact DirectAdmin support.

Jeff
 
Many of our accounts have multiple domains, and they have their own email addresses.

Is this something just started happening on a system where it worked before?

Anyone else having this problem?

Perhaps you should contact DirectAdmin support.

Jeff

dear jlasman,

now you mention it. my system is fairly new. but before the update i did had account with multiple domains and they do not have the problem.

i guess its either because they are created under an reseller. and the domains are add later by the user itself and not by the admin..

food for tought and test

i'll contact support also..

thanks for your reply

Soul
 
dear all i did have contact with support, and after testing i was unable to reacreate the problem with new accounts made form admin or resellers.

this really is strange i ended up creating a modified version of the rebuild /etc/virtual script on http://help.directadmin.com/item.php?id=66

it is kinda quick and dirty, but purhaps its usefull to someone
in a sense you can verify your da /etc/virtual with files that should be there or not.
for me this helped a lot. still its strange why a lot of these file were not created.

(i did made this on freebsd i am aware of the == and = difference in the if statements in bash and sh not sure purhaps someone can test)

and i would not advise to use the -fixitnowsureyes if the default output does not make any sense

the syntax: sh checkdauser.sh [username|-all] [-fixitnowsureyes]

it does not print any output if all files are valid and ok.

the script has commented out the option of creating the quota and majordomo
on some test installations i did not use these options so these files were also not created for all users. uncomment to check these too.

there are two config parameters in the script

DAPATH="/usr/local/directadmin"
DAVIRT="/etc/virtual"

logical i assume

here it goes.

#!/bin/sh
# by: jan [ .,-a.t-,. ] makeitwork.nu
# version 1.1
################################################################

# config variables

DAPATH="/usr/local/directadmin"
DAVIRT="/etc/virtual"

################################################################

# Pointers
pexiu=0
# warning if you set this option it will allways try to fix things
FIXOPTION=0

################################################################

# arg 2 to fix or not

fixoption=$2
fixoption=`echo $fixoption | tr "[:upper:]" "[:lower:]"`

if [ ! "x$fixoption" = "x" ]
then

if [ ! "$fixoption" = "-fixitnowsureyes" ]
then
echo supply valid fix option
exit 2
else
FIXOPTION=7
fi
fi

# init userid variable
u=$1
if [ "x$u" = "x" ]
then
echo "syntax: checkdauser [username|-all] [-fixitnowsureyes]"
exit 1
fi

u=`echo $u | tr "[:upper:]" "[:lower:]"`

################################################################

#verify userid with DA

if [ "x$u" = "x-all" ]
then
pexiu=2
else

exiu=`ls $DAPATH/data/users | grep -i $u`
exiu=`echo $exiu | tr "[:upper:]" "[:lower:]"`

if [ "x$u" = "x" ]
then
pexiu=0
else
if [ "x$u" = "x$exiu" ]
then
pexiu=1
fi
fi
fi

if [ $pexiu -eq 0 ]
then
echo DA user $u does not exist.
exit 1
fi

################################################################

#functions

valdomown ()
{
valdo=`cat $DAVIRT/domainowners | grep -i $1`
valdo=`echo $valdo | tr "[:upper:]" "[:lower:]"`

if [ "x$valdo" = "x" ]
then
echo Missing for $u $1: $2 in domainowners

if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $DAVIRT/domainowners with $1: $2
echo "$1: $2" >> $DAVIRT/domainowners
chown mail:mail $DAVIRT/domainowners
chmod 644 $DAVIRT/domainowners
fi
return 0
else
return 1
fi
}


valdom ()
{
valdom=`cat $DAVIRT/domains | grep -i $1`
valdom=`echo $valdom | tr "[:upper:]" "[:lower:]"`

if [ "x$valdom" = "x" ]
then
echo Missing for $u $1 in domains

if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $DAVIRT/domains with $1
echo "$1" >> $DAVIRT/domains
chown mail:mail $DAVIRT/domains
chmod 644 $DAVIRT/domains
fi

return 0
else
return 1
fi
}

valdomfolfiles ()
{

if [ ! -f $1/aliases ]; then
echo missing $1/aliases
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/aliases with creating $1/aliases
echo "$u: $u" > $1/aliases
chown mail:mail $1/aliases
fi
fi

if [ ! -f $1/autoresponder.conf ]; then
echo missing $1/autoresponder.conf
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/autoresponder.conf with creating $1/autoresponder.conf
echo "" > $1/autoresponder.conf
chown mail:mail $1/autoresponder.conf
fi
fi

if [ ! -f $1/filter ]; then
echo missing $1/filter
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/filter with creating $1/filter
echo "" > $1/filter
chown mail:mail $1/filter
fi
fi

if [ ! -f $1/filter.conf ]; then
echo missing $1/filter.conf
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/filter with creating $1/filter.conf
echo "" > $1/filter.conf
chown mail:mail $1/filter.onf
fi
fi

if [ ! -f $1/passwd ]; then
echo missing $1/passwd
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/passwd with creating $1/passwd
echo "" > $1/passwd
chown mail:mail $1/passwd
fi
fi

#if [ ! -f $1/quota ]; then
#echo missing $1/quota
# if [ "x$FIXOPTION" = "x7" ]
# then
# echo FIXING: $1/quota with creating $1/quota
# echo "" > $1/quota
# chown mail:mail $1/quota
# fi
#fi

if [ ! -f $1/vacation.conf ]; then
echo missing $1/vacation.conf
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/vacation.conf with creating $1/vacation.conf
echo "" > $1/vacation.conf
chown mail:mail $1/vacation.conf
fi
fi

#if [ ! -d $1/majordomo ]; then
#echo missing Folder $1/majordomo
# if [ "x$FIXOPTION" = "x7" ]
# then
# echo FIXING: $1/majordomo with creating $1/majordomo
# mkdir $1/majordomo
# chmod 751 $1/majordomo
# chown majordomo:daemon $1/majordomo
# fi
#fi

if [ ! -d $1/reply ]; then
echo missing Folder $1/reply
if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $1/reply with creating $1/reply
mkdir $1/reply
chmod 700 $1/reply
chown mail:mail $1/reply
fi
fi

}

valdomfol ()
{
valdomfol=`echo $1 | tr "[:upper:]" "[:lower:]"`

if [ ! -d $DAVIRT/$valdomfol ]
then
echo Missing for $u Folder $DAVIRT/$valdomfol

if [ "x$FIXOPTION" = "x7" ]
then
echo FIXING: $DAVIRT/$valdomfol with creating $DAVIRT/$valdomfol
mkdir $DAVIRT/$valdomfol
chmod 711 $DAVIRT/$valdomfol
chown mail:mail $DAVIRT/$valdomfol

valdomfolfiles $DAVIRT/$valdomfol
fi

else
valdomfolfiles $DAVIRT/$valdomfol
fi
}

valdompoint ()
{
if [ -f $DAPATH/data/users/$2/domains/$1.pointers ]
then
valdompoint=`cat $DAPATH/data/users/$2/domains/$1.pointers | grep -i $1`
valdompoint=`echo $valdompoint | tr "[:upper:]" "[:lower:]"`

if [ "x$valdopoint" = "x" ]
then
echo Missing for $u $1: $2 in domain pointers
return 0
else
return 1
fi
fi
}


################################################################

# gather domainnames

checkuser ()
{
if [ ! -f $DAPATH/data/users/$u/domains.list ]
then
echo $DAPATH/data/users/$u/domains.list Does not exist.
exit 1
fi

for d in `cat $DAPATH/data/users/$u/domains.list`; do
{
valdomown $d $u
valdom $d
valdomfol $d
#valdompoint $d $u
}
done;
}

################################################################

# Main loop

case "$pexiu" in

0 )
echo exit?
;;

1 )
checkuser
;;

2 )
for u in `ls $DAPATH/data/users`; do
{
checkuser
}
done;
;;

* )
echo how u ver got here?
;;
esac
 
Last edited:
Back
Top