Thursday, July 24, 2008

Sendmail support - virtusertable file

Sendmail use this file to do mail routing between all the domains that is on your mail server. How do you think sendmail cope with all the support@ or sales@ email addresses for all the domains. This file and the aliases file are used to group and relay the email addresses to the correct user on the mail server. There is 5 ways to distributing the mail in this file, which I will show examples for ;-)

Edit this file by typing : " vi /etc/mail/virtusertable "

Inside this file, you need to do the config as follow:

# BEGIN

webmaster@lds.za.net ldsuser1
smith@lds.za.net jsmith
gbates@lds.za.net ldsuser2

# Domain linuxhelp.za.net

webmaster@linuxhelp.za.net lin001
smith@linuxhelp.za.net lin002
gbates@linuxhelp.za.net lin003

# END

As you can see from this example file, we tried to show that you can have exactly the same email address or name for each domain name, and this shows you how you route it to the different users on the system. to create a email user on a Linux server, use the following command, we will use the username lin001 as example:

" useradd -d /home/lin001 -s /bin/false -c "Linuxhelp mail user" -g mail lin001 "

This will create a user without bash access, so this is a safe way of adding mail users. The -d option is the home directory location, this will NOT move the pop3 mailbox from /var/spool/mail to /home/lin001.

The -s option specify the shell access, the reason why we use /bin/false is to prevent a mail user with a simple password to have bash access which will lead to security problems.

The -c option is to add a comment line in the /etc/passwd file to identify a username, this works great to find any suspicious users that could have been created by a hacker

again, just reload sendmail after you have made the changes, or use the sendmailreload script I have made.

No comments: