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

I've found on a couple servers that have the following entry in /etc/aliases:

root: \root,email@example.com

You can send mail to /dev/null like this:

root: /dev/null

I can't find \root used in any documentation.

  1. Does \root do anything?
  2. Could it be a syntax error?
share|improve this question
1  
You seem to be right that the backslash syntax does not appear to be documented in "man 5 aliases" where one would expect it to be mentioned (or at least I cannot find it in my section 5 aliases man page) but this is a longstanding feature of the mail aliases file. –  Michael McNally Jan 23 '13 at 6:29
add comment

4 Answers

up vote 5 down vote accepted
 but I can't find what the \ does

The backslash "escapes" the token following, preventing further interpretation.

It's an important mechanism in defining aliases like the example in your post, where "root" is aliased to include both the account of that name AND other addresses. Without the \ a loop would be created when the program interpreting the alias tried to dereference "root", which includes as a member "root" (which includes as a member "root", and so on..)

share|improve this answer
add comment

I believe that \root prevents that id from being passed through aliases again and (instead is) delivered to the LOCAL root account.

share|improve this answer
add comment

\root will save the message to (for example) /var/mail/root and forward it to email@example.com. Without it, only email@example.com will receive the message. The \user, other@address notation is very common for users that use ~/.forward files.

share|improve this answer
add comment

Putting a backslash (\) in front of the username in the first recipient is a special syntax for delivering mail to the local mail spool with no further aliasing.

root: \root,email@example.com

Here, user root is forwarding mails to two different places:

  1. One copy of the message goes to the mail spool
  2. The second recipient, email@example.com, sends another copy of message to MX servers of example.com

Please find details here.

share|improve this answer
add comment

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.