Quantcast
Channel: 自転車で通勤しましょ♪ブログ » postfix
Viewing all articles
Browse latest Browse all 2

Postfix & procmail root宛のメールが届かない件

0
0

自宅サーバが結構な頻度で落ちる…。原因は未だ不明。手動で電源を落として再起動させているので不安が募る。4時頃に落ちるから、cronの関係で負荷が上がった時にハングアップするんだろうか?でも24時間扇風機当ててるのになぁ。

今日はPostfix & procmailでroot宛のメールが届かない件について。root宛のメールがエラーで全く届いていないことがmaillogより発覚。以下のようなログが出続けていた。

May 15 10:37:44 master postfix/local[4897]: C461E27500D8: to=<root@********.net &rt;, relay=local, delay=0.59, delays=0.56/0.01/0/0.02, dsn=5.2.0, status=bounced (can’t create user output file. Command output: procmail: Couldn’t create “/var/mail/nobody” procmail: Couldn’t chdir to “//Maildir” procmail: Error while writing to “./.procmail.log” procmail: Unable to treat as directory “./new” procmail: Skipped “.” )

rootディレクトリ直下にはちゃんとMaildirディレクトリも作ってあるのだけれど、何故かわからないまま色々と調べていたら、本家サイトのFAQにこのように書いてあった。

http://www.postfix.org/faq.html

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.

Solution: just like you’re not supposed to log in as root (except for unusual conditions), you’re not supposed to receive mail as root.

* Create a mail alias for root that forwards mail to a real user.

/etc/aliases:
root: you

* Execute the command newaliases whenever you change the alias database.

On some systems the alias database is not in /etc/aliases. To find out the location for your system, execute the command postconf alias_maps.

procmail使ってると、Postfixはroot宛のメールはnobodyに送るよ。リアルなユーザを作ってroot宛のメールをaliasで転送するようにしてねって書いてあると判断した。/etc/aliasesをエディタで開いて、最後の行に以下を追加した。real_userは適当に変えてください。

root: real_user

その後、newaliasesコマンドを使ってエイリアス情報を上書きする。
試しにgmailからroot宛にメールを送ったらreal_userに対してメールが配信されていた。とりあえずOKとする。


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images