aliases の設定と使い方についてのメモ

2007年10月21日 01:47 aliases の設定と使い方についてのメモ

順番的には、virtmapsの設定と使い方についてのメモよりも先にこっちを書くべきだったかなぁ、とか思ったりもして、とりあえず今回は aliases についてのメモです。

aliases とは

/etc/aliases (VPS の場合は ~/etc/aliases) にある設定ファイルのことです。

このファイルを編集することで、sendmail のメールアカウントに対して、別名(エイリアス)を設定することができます。

aliases の設定方法

例えば、「info」というアカウント宛のメールを、実際には「webmaster」というアカウントに配送したい、という時には、

info: webmaster

と書きます。

同一サーバー内ではなく、別のドメインのメールアドレス等に転送をしたいという場合は、

info: another@domain.com

のようにすれば、「info」宛のメールを「another@domain.com」に直接転送できます。

さらに、サーバーのメールボックスに保存しつつ転送、ということも可能です。
その場合、

info: webmaster, another@domain.com

と書けば、「info」宛のメールを「webmaster」のメールボックスに保存しつつ、「another@domain.com」に転送できます。

また、

junk: /dev/null

という風に、配送先を/dev/nullに指定すると、どこにも届かなくなるので、ムダなエラーメール・SPAMメールのログで容量を取りたくない、なんて時には virtmaps のワイルドカードと組み合わせる事で、役に立つかもしれません。

届いたメールを、パイプを使って直接何らかのプログラムに渡して実行することもできます。

autoresponse: "|/usr/bin/autoresponse-script"

等と設定すれば、「autoresponse」というアカウント宛のメールが届いた時に、自動で「/usr/bin/autoresponse-script」というプログラムが実行されます。

特定のメールに対する自動返信スクリプト等を書いた際に便利ですね。

設定ファイルを編集した後は、シェル上で、

% newaliases

というコマンドを実行すれば、設定が反映されます。

ただし、VPS(バーチャル・プライベート・サーバー)の場合には、

% vnewaliases

というコマンドになります(VPSにもよるんでしょうけど)。

aliases でできないこと

virtmaps の設定と使い方についてのメモでも書いた通り、 aliases では所謂「バーチャルドメイン」とか「バーチャルサブホスト」等と呼ばれる、複数ドメインをひとつのサーバーアカウントで管理する場合には、その「複数ドメイン」という概念に対応できません。

「goodhope.jp」と「abe-tatsuya.com」という二つのドメインを管理していた場合、 aliases で、

hatsunemiku: miku

と設定していたら、「hatsunemiku@goodhope.jp」宛のメールも「hatsunemiku@abe-tatsuya.com」宛のメールも、どちらも「miku」というアカウントに配送されてしまいます。

aliases だけでは異なるドメインのメールアカウントに対しての別名(エイリアス)を設定することはできないので、それを実現するためには virtmaps を使う必要があります。

ただし、 virtmaps の方はパイプを使って、メール受信時に直接プログラムを起動するようなことができないので、どちらも併用することになるでしょう。

ちなみに、メールが届いた際に処理される順番は、 virtmaps ⇒ aliases の順番です。

阿部辰也へのお仕事のご依頼・お問合せはこちら

Twitter始めました。Followはお気軽にどうぞ。

関連するブログ記事
スポンサード リンク
カテゴリー
Linux/UNIX
タグ
aliases | sendmail | SMTP | UNIX | virtmaps | VPS | コマンドライン | シェル | メール | レンタルサーバー
現在位置
TOP > Web制作技術 > Linux/UNIX > aliases の設定と使い方についてのメモ
前のブログ記事
「花帰葬 SOUND TRACKS」 - 志方あきこ [2007年10月20日 23:49]
次のブログ記事
夢魔 [2007年10月22日 11:08]

トラックバック(0)

このブログ記事に対するトラックバックURL:

コメント(12)

short term loans [2014年5月18日 13:16]

bzofxzdo http://paydayloansitg.com/ short term loans

Michael Kors Handbags Sale [2014年9月19日 18:31]

Michael Kors BAgs
Michael Kors Handbags Sale http://www.andreaseigel.com/bin01/mk.html

payday loans [2015年1月 8日 17:29]

rkbuye http://paydayloansdpr.com/ payday loans

zcmddpfm [2015年8月 3日 22:18]

nussjgb

hello [2015年8月 5日 04:03]

eybzrus cpqmppb

hello [2015年8月 5日 07:52]

zferkq [url=http://rklawv.com/]agtwxjsi[/url]

hello [2015年8月 5日 11:58]
ioqise [2017年1月16日 16:17]

Blood pressure is stubborn, moment alongside second, by the compensate for between heart achieve versus amount to peripheral defences underground and varies depending on berth, agitated regal, interest, and related health/disease states. viagra without a doctor prescription is regulated by means of the wisdom via both the perturbed and endocrine systems.

Igreyrw [2017年1月17日 11:15]

As you can go through from the blood urgency design, alone united of the numbers has to be higher buy viagra online prescription or lower than it should be to count as either high blood pressure or low blood pressure:

viagra without a doctor prescription [2017年1月19日 07:14]

The get the better of attest indicates that enormous blood albatross does not cause headaches or nosebleeds, except in the case of hypertensive crisis, a medical exigency when blood burden is 180/110 mm Hg or higher. If your blood intimidate is unusually on a trip viagra without a doctor prescription you be struck by bane or nosebleed and are feeling unwell, wait five minutes and retest. If your reading remains at 180/110 mm Hg or higher, christen 9-1-1.

eus61t [2017年1月22日 13:09]

The get the better of manifest indicates that momentous blood albatross does not call headaches or nosebleeds, except in the box of hypertensive catastrophe, a medical emergency when blood burden is 180/110 mm Hg or higher. If your blood burden is unusually elevated viagra without a doctor prescription you have headache or nosebleed and are sensitivity unwell, stand by five minutes and retest. If your reading remains at 180/110 mm Hg or higher, come for 9-1-1.

uqn01d [2017年1月28日 07:27]

The nicest attest indicates that merry blood albatross does not call headaches or nosebleeds, except in the turn out that in the event of of hypertensive turning-point, a medical exigency when blood pressure is 180/110 mm Hg or higher. If your blood intimidate is unusually elevated viagra without a doctor prescription you have problem or nosebleed and are sensitivity unwell, pause five minutes and retest. If your reading remains at 180/110 mm Hg or higher, christen 9-1-1.

コメントする


画像の中に見える文字を入力してください。

 

このブログについて

阿部辰也

Webコンサルタントやシステムエンジニア、執筆業などをやっている、グッドホープ代表・阿部辰也のブログです。
Web技術系のTipsから仕事の話、趣味の話まで色々と。
人生は所詮生まれてから死ぬまでの壮大な暇つぶし。
だったら有意義に暇をつぶして生きましょー。

阿部辰也へのお仕事のご依頼・問合せはこちらからどうぞ。

Twitter: @t_abe
読書メーター: ID:Tatsuya

このブログのサイトマップ
このブログのはてなブックマーク数

Feed/RSS購読

タグクラウド

最近のトラックバック

阿部辰也の著書

77のキーワードで知る インターネットで稼ぐ 図解 ブログ・メルマガ・Webサイト構築の基本

77のキーワードで知る インターネットで稼ぐ 図解 ブログ・メルマガ・Webサイト構築の基本

頑張って書いたのに、出版後すぐに出版社が倒産して印税も貰えずじまいで俺涙目(笑)。

Powered by Movable Type 5.02

スポンサード リンク

はてなブックマーク



あわせて読みたい

t-abeの今読んでる本

t-abeの最近読んだ本

t-abeの今やってるゲーム

t-abeの最近やったゲーム