If you get a 550 error as a reply when you email a user with directadmin, saying Remote host said: 550 “Unknown User” or The error that the other server returned was: 550 550 “Unknown User” (state 13). or something equivalent, then the problem might be your virtual domainowner settings.

This happens with exim especially when moving from one server to another via Directadmin.

To verify this solution, first check your paniclog:

tail /var/log/exim/paniclog

If you get something like this:

2012-06-08 18:53:01 1SczTF-0002Cj-B8 Failed to find user “” from expanded string “${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}” for the domain_filter router

then you probably have an issue with your domainowners file. as you can see, the perl script can’t parse the username, hence the error “unknown user” when receiving email.

The solution is to rebuild the /etc/virtual directory

Get a backup

cd /etc
cp -Rp virtual virtual.backup

Verify its existance

mkdir -p /etc/virtual
chmod 755 /etc/virtual
chown mail:mail /etc/virtual

Create this script and save it somewhere, let’s say /root/fix_virtual.sh


echo -n '' > /etc/virtual/domains
echo -n '' > /etc/virtual/domainowners

mkdir -p /etc/virtual/`hostname`
chown mail:mail /etc/virtual/`hostname`
chmod 711 /etc/virtual/`hostname`
echo `hostname` >> /etc/virtual/domains

for u in `ls /usr/local/directadmin/data/users`; do
       for d in `cat /usr/local/directadmin/data/users/$u/domains.list`; do
               echo "$d: $u" >> /etc/virtual/domainowners
               echo "$d" >> /etc/virtual/domains


               mkdir -p $DMN
               chmod 711 $DMN
               chown mail:mail $DMN

               touch $DMN/aliases
               if [ ! -s $DMN/aliases ]; then
                       echo "$u: $u" > $DMN/aliases
               touch $DMN/autoresponder.conf
               touch $DMN/filter
               touch $DMN/filter.conf
               touch $DMN/passwd
               touch $DMN/quota
               touch $DMN/vacation.conf
               chown mail:mail $DMN/*

               mkdir -p $DMN/majordomo
               chmod 751 $DMN/majordomo
               chown majordomo:daemon $DMN/majordomo

               mkdir -p $DMN/reply
               chmod 700 $DMN/reply
               chown mail:mail $DMN/reply

               for p in `cat /usr/local/directadmin/data/users/$u/domains/$d.pointers 2>/dev/null`; do
                       echo "$p: $u"  >> /etc/virtual/domainowners
                       echo "$p" >> /etc/virtual/domains
                       ln -s $d /etc/virtual/$p

chown mail:mail /etc/virtual/domains
chown mail:mail /etc/virtual/domainowners
chmod 644 /etc/virtual/domainowners
chmod 644 /etc/virtual/domains

Make it exacutable and run.

chmod 755 /root/fix_virtual.sh

Restart exim services

service exim restart

Your problem should be fixed.

Leave a Reply

Your email address will not be published.