Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

An inbox is automatically created for every UNIX user on the box, when the mail is sent to the nodename of the system.

Is there a way to disable these default inboxes?

An example of one of these inboxes is root@nodename.

It would be preferable not to remove the nodename from local-host-names.

I do have other domains set up on this sendmail server, that need to stay running.

share|improve this question
    
What do you mean by disabling? Should mail to these mail boxes be discarded? Forwarded somewhere else? –  adamo Aug 28 '12 at 18:47
    
Discarded, unless I say otherwise in virtusertable. Currently, the virtusertable lists all valid email addresses. If root@nodename is not in virtusertable, then it should be discarded. –  George Bailey Aug 29 '12 at 14:27

1 Answer 1

First you need to have a look here, in order to understand how to produce a sendmail.cf from sendmail.mc and restart sendmail afterwards.

Now forget virtusertable. We will define a class of usernames which are allowed to receive mail. All the rest will be discarded. To do this we add the following section in sendmail.mc

LOCAL_CONFIG
C{Receive} user1 user2 user3

If you want to define these users in an external file, instead of directly editing your sendmail.mc, use an F line, instead of a C line:

LOCAL_CONFIG
F{Receive} -o /etc/mail/receive.allow

This way each line in the file /etc/mail/receive.allow contains a username that is allowed to receive mail. The -o switch makes sure that sendmail will not complain if the file does not exist.

Now that the users that are allowed to receive mail are defined, we add the following lines next:

LOCAL_RULE_0
R${Receive}       $#OK
R${Receive} < @ $=w . > $*        $#OK
R$*        $#discard $: $1

Do not copy paste the above snippet of code. The left hand side of the code is tab separated from the right hand one. So type it instead. Next follow the instructions for how to compile sendmail.cf from sendmail.mc and restart sendmail.

Each time you modify sendmail.mc in order to add a user, you need to reproduce sendmail.cf and restart sendmail. If you choose to store allowed users in an external file, each time you modify this file you need to restart sendmail (no need for a new sendmail.cf).

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.