Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need to set up a lot of email addresses on a Linux machine, but I don't want to create a new user account for each one.

The mail can stored in a regular maildir or mbox. (I'll be checking the mail through some Perl code running on a cronjob.)

How do I do this?

share|improve this question
1  
what mail delevery agent and mail transfer agent are you using? –  echox Oct 1 '10 at 17:45
add comment

2 Answers

You can use virtual users (and domains) stored on a database so you don't need to create linux users to the mailboxes and the admin of the mail users and domain is very simple, just adding or removing a record in the database table.

an example for ubuntu, postfix and mysql

share|improve this answer
add comment

The full answer really depends on what mail server program you are using.

For both the postfix and sendmail you can redirect mail addresses to local accounts using the /etc/aliases file: any line of the form address: unix-account will deliver email addressed to address@your.domain to the mailbox of unix-account. For example, if /etc/aliases contains a line like this:

postmaster: root

then UNIX user root will get all the mail addressed to postmaster@your.domain, without any need for postmaster to exist as a regular UNIX account.

Instead of a UNIX account name, you can specify the full path of a file -- mail will be delivered to that file (in mbox format). Other redirections are also possible; see man aliases for details.

Note: after editing /etc/aliases, you have to run the command newaliases (as root, typically) in order to have the mail server pick up the new addresses.

share|improve this answer
    
That worked, thank you. –  Justin Oct 4 '10 at 21:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.