Why are emails sent to root redirected to nobody?
Solution 1:
Check for the existence of a file named $HOME/.forward
. If this file exists, and contains an email address or local username, then incoming mail for the user who owns the file will be forwarded to the address given.
For instance, it might look like this:
debian9@hwy:~$ sudo cat /root/.forward
nobody
debian9@hwy:~$
Solution 2:
As some material states:
procmail
Root's mail is delivered to nobody If you use procmail (or some other command) for local mail delivery, Postfix will not deliver mail as root. Instead, Postfix runs procmail (or whatever) as nobody. Perhaps some day Wietse will trust Postfix enough to run external commands as root.
Postfix not only runs procmail (or whatever) as nobody, but also deliver email to nobody as root.
Some old material in the web: Strange delivery in postfix/procmail configuration
Postfix's own delivery agent can deliver to root's mailbox, but postfix will NEVER fork an external program (e.g. procmail) as root. it either changes UID to the owner of the mail being delivered or if that user is root, then it changes UID to nobody.
So procmail gets run as nobody when delivering root's mail.