Directadmin : Problem Receiving Emails – The “Unknown User” Issue

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 
#!/bin/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
    
DMN=/etc/virtual/$d
   
mkdir -p $DMN
chmod 711 $DMN
chown mail:mail $DMN
 
touch $DMN/aliases
if [ ! -s $DMN/aliases ]; then
           echo "$u: $u" > $DMN/aliases
fi
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
};
done;
}
done;
}
done;
   
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

/root/fix_virtual.sh


Restart exim services
   
service exim restart


Your problem should be fixed.
  • 91 Users Found This Useful
Was this answer helpful?

Related Articles

Adding New IP to DirectAdmin From Different Subnet and Gateway

Earlier I’ve posted an article describing how to add multiple ip addresses on a single...

PHP-SOAP Installation on DirectAdmin

People using Direct Admin usually do the mistake to install anything new by using the yum...

How to Reset DirectAdmin “admin” Password

DirectAdmin determines the admin password during installation and saves these passwords into the...

MySQL root password recovery in DirectAdmin

Before changing MySQL root password you may try to recover default installation password....

Step III: DirectAdmin post installation tasks

There are some important processes after successfully installation of DirectAdmin and if you miss...