If you wish for specific default forwarders be present for new domains, for example "postmaster", you can create the script:
/usr/local/directadmin/scripts/custom/domain_create_post.sh
and add the code#!/bin/sh
#modify the TO value as desired
TO=${username}
ALIASES=/etc/virtual/${domain}/aliases
TEMP_ALIASES=${ALIASES}.temp
addalias()
{
COUNT=`grep -c -e "^${1}:" ${ALIASES}`
if [ "${COUNT}" -eq 0 ]; then
echo "${1}: ${TO}" >> ${TEMP_ALIASES}
cat ${ALIASES} >> ${TEMP_ALIASES}
mv -f ${TEMP_ALIASES} ${ALIASES}
chown mail:mail ${ALIASES}
fi
}
addalias postmaster
exit 0;
chmod 755 /usr/local/directadmin/scripts/custom/domain_create_post.sh
You can add more lines, in addition to the postmaster entry to add more aliases by default.If you wish to apply this to existing domains, you can create the script
/root/fix.sh
and add the code:#!/bin/sh
for u in `ls /usr/local/directadmin/data/users`; do
{
for d in `cat /usr/local/directadmin/data/users/${u}/domains.list`; do
{
domain=$d username=$u /usr/local/directadmin/scripts/custom/domain_create_post.sh
};
done;
};
done;
exit 0;
cd /root
chmod 755 fix.sh
./fix.sh