成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Postfix配置文件和命令

運(yùn)維 系統(tǒng)運(yùn)維
postfix是一種郵件傳輸代理軟件,我們?cè)谑褂胮ostfix的同時(shí),還應(yīng)該熟悉postfix中的一些命令。這對(duì)于今后的維護(hù)是很有幫助的。本文主要分析的是postfix中的一些命令,這對(duì)今后維護(hù)postfix的工作是十分有必要的。

  熟悉postfix中的一些命令,對(duì)于今后的維護(hù)是很必要的。接下來(lái)會(huì)分析其中一些重要的配置文件和相關(guān)命令.

  一、總體說(shuō)明

  引用

  /etc/postfix/main.cf

  這是postfix的主配置文件,幾乎所有的配置都在這里設(shè)定。設(shè)定完畢后,需要用reload或restart重新讀取配置信息。(涉及網(wǎng)絡(luò)的配置,需要使用restart)

  引用

  /etc/postfix/master.cf

  這個(gè)是postfix子程序的運(yùn)行狀態(tài)設(shè)置,例如是否使用chroot等。

  引用

  /etc/postfix/access

  類似黑白名單的作用,設(shè)置完畢后,需要在main.cf中激活,并使用postmap生成相關(guān)的數(shù)據(jù)庫(kù)。

  引用

  /etc/aliases

  別名的設(shè)置目錄,同樣,需要在main.cf中激活,并使用postalias生成相關(guān)數(shù)據(jù)庫(kù)。

  二、main.cf文件

  該文件的配置比較規(guī)范,文件中也帶了很詳細(xì)的幫助說(shuō)明。其主要包括幾部分:

  1、“#”號(hào)開(kāi)頭,表示改行是注釋;

  2、可以使用下面的形式給變量定義:

  引用

  變量 = 值

  請(qǐng)注意等號(hào)兩邊需要留一空格。并且變量最好符合Bash的規(guī)范。

  3、可以使用“$變量”來(lái)引用該變量的值;

  例如 myorigin = $myhostname,會(huì)等于 myorigin = linuxfly.org;

  4、如果變量使用兩個(gè)以上的數(shù)據(jù),可以用空格符或逗號(hào)來(lái)分隔,設(shè)置跨行也可以;

  例如:

  引用

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

  也可以寫(xiě)為:

  引用

  mydestination = $myhostname localhost.$mydomain localhost $mydomain

  或:

  引用

  mydestination = $myhostname,

  localhost.$mydomain,

  localhost,

  $mydomain

  結(jié)果是相同的。

  5、可以使用hash等格式進(jìn)行更規(guī)范的設(shè)定;

  例如:

  引用

  alias_maps = hash:/etc/aliases

  那么,相關(guān)的值就可以寫(xiě)入/etc/aliases文件中。

  6、若重復(fù)設(shè)定某一變量的設(shè)定,則以最后出現(xiàn)的設(shè)定值為準(zhǔn)~!

  三、/etc/postfix/access文件

  1、需要在main.cf中打開(kāi)

  引用

  /etc/postfix/main.cf:

  smtpd_client_restrictions = check_client_access hash:/etc/postfix/access

  2、設(shè)定值

  例如:

  引用

  /etc/postfix/access:

  192.168.228.10 REJECT

  192.168.228.1 OK

  linuxfly.org OK

  3、生成數(shù)據(jù)庫(kù)

  # postmap hash:/etc/postfix/access

  四、/etc/aliases文件

  1、同樣需要在main.cf中打開(kāi)

  引用

  /etc/postfix/main.cf:

  alias_database = hash:/etc/aliases

  alias_maps = hash:/etc/aliases

  2、設(shè)定值

  引用

  /etc/aliases:

  mailer-daemon: postmaster

  postmaster: root

  root: linuxing,root

  前面是鍵值,后面是真實(shí)的值。真實(shí)的值不要求是本地郵件,也可以是外面的郵箱,例如:linuxing@163.com等。

  3、生成數(shù)據(jù)庫(kù)

  # postalias hash:/etc/aliases

  ※這會(huì)生成類似.db的數(shù)據(jù)庫(kù)文件,主要是為了讓postfix能快速的讀取。其他可以使用多值的地方也可以該方式定義。默認(rèn)會(huì)自動(dòng)識(shí)別,但也可以用“hash:文件”指定格式。

  4、若是個(gè)人用戶,可以設(shè)置主目錄下的~/.forward文件,也可以設(shè)置別名,一行一個(gè)Email地址,例如:

  引用

  [linuxing@dc5test ~]$ cat .forward

  test

  test@test.com

  [linuxing@dc5test ~]$ chmod 644 .forward

  權(quán)限不要搞錯(cuò)了!

  五、postfix主要命令

  1、查看配置信息

  引用

  [root@dc5test postfix]# postconf -n

  alias_database = hash:/etc/aliases

  alias_maps = hash:/etc/aliases

  broken_sasl_auth_clients = yes

  command_directory = /usr/sbin

  config_directory = /etc/postfix

  daemon_directory = /usr/libexec/postfix

  debug_peer_level = 2

  html_directory = no

  inet_interfaces = $myhostname, localhost

  mail_owner = postfix

  mailq_path = /usr/bin/mailq.postfix

  manpage_directory = /usr/share/man

  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

  mydomain = linuxfly.cn

  mynetworks = 192.168.218.0/24, 127.0.0.0/8

  myorigin = $mydomain

  newaliases_path = /usr/bin/newaliases.postfix

  queue_directory = /var/spool/postfix

  readme_directory = /usr/share/doc/postfix-2.1.5/README_FILES

  relay_domains = $mydestination

  sample_directory = /usr/share/doc/postfix-2.1.5/samples

  sendmail_path = /usr/sbin/sendmail.postfix

  setgid_group = postdrop

  smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

  smtpd_sasl_auth_enable = yes

  smtpd_sasl_security_options = noanonymous

  unknown_local_recipient_reject_code = 550

  2、查看隊(duì)列信息

  引用

  # mailq

  -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------

  DB7678DA5 289 Wed Aug 22 16:46:28 root@linuxfly.org

  (Host or domain name not found. Name service error for name=linuxfly.org type=MX: Host not found, try again)

  root@linuxfly.org

  -- 0 Kbytes in 1 Request.

  或

  引用

  # postqueue -p

  -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------

  DB7678DA5 289 Wed Aug 22 16:46:28 root@linuxfly.org

  (Host or domain name not found. Name service error for name=linuxfly.org type=MX: Host not found, try again)

  root@linuxfly.org

  -- 0 Kbytes in 1 Request.

  結(jié)果是一樣的。

  3、強(qiáng)制發(fā)出郵件

  # postfix flush

  或

  # postqueue -f

  這會(huì)把隊(duì)列中的郵件再發(fā)一次。可以處理一些臨時(shí)的錯(cuò)誤問(wèn)題。

  4、查看在發(fā)郵件信息

  在發(fā)的郵件會(huì)放在/var/spool/postfix/deferred目錄中,但其中含有一些postfix特定字符,可通過(guò)postcat查看:

  引用

  # postcat DB7678DA5

  *** ENVELOPE RECORDS DB7678DA5 ***

  message_size: 289 163 1 0

  message_arrival_time: Wed Aug 22 16:46:28 2007

  named_attribute: message_origin=local

  sender_fullname: root

  sender: root@linuxfly.org

  original_recipient: root@linuxfly.org

  recipient: root@linuxfly.org

  *** MESSAGE CONTENTS DB7678DA5 ***

  Received: by dc5test.linuxfly.org (Postfix, from userid 0)

  id DB7678DA5; Wed, 22 Aug 2007 16:46:28 +0800 (CST)

  To: root@linuxfly.org

  Subject: test

  Message-Id: <20070822084628.DB7678DA5@dc5test.linuxfly.org>

  Date: Wed, 22 Aug 2007 16:46:28 +0800 (CST)

  From: root@linuxfly.org (root)

  *** HEADER EXTRACTED DB7678DA5 ***

  *** MESSAGE FILE END DB7678DA5 ***

  5、一些Email測(cè)試用命令

  ◎mail,字符下的客戶端

  $ mail -s 'subject' linuxing < ~/file

  把file中的內(nèi)容作為郵件內(nèi)容,以subject做標(biāo)題,發(fā)給本地的linuxing用戶。

  引用

  $ mail -s 'subject' linuxing

  test

  Ctrl-D保存退出

  Cc: root

  ●mail直接回車

  則是作為本地的郵件接收客戶端,可以用d刪除,回車查看,序號(hào)查看,help幫助或q退出等操作。

  引用

  # mail

  Mail version 8.1 6/6/93. Type ? for help.

  "/var/spool/mail/root": 2 messages 2 unread

  >U 1 root@linuxfly.org Tue Aug 21 11:56 94/2251 "LogWatch for dc5test"

  U 2 root@linuxfly.org Tue Aug 21 11:57 23/846 "Anacron job 'cron.daily'"

  ●使用mail發(fā)送附件

  # uuencode /root/install.log install.log|mail -s 'install log' linuxing

  uuencode后第一個(gè)參數(shù)的本地文件,第二個(gè)參數(shù)是郵件中的附件名稱。

  ●字符下收信:

  引用

  $ mail

  Mail version 8.1 6/6/93. Type ? for help.

  "/var/spool/mail/linuxing": 1 message 1 new

  >N 1 root@linuxfly.org Wed Aug 22 17:10 853/52344 "install log"

  & s 1 install.log

  "install.log" [New file]

  & exit

  會(huì)保存為install.log文件,然后再解壓出來(lái):

  $ uudecode install.log -o install.log

  uudecode: install.log: Short file

  ◎telnet,測(cè)試smtp和pop3服務(wù)

  ●smtp服務(wù)

  引用

  # telnet localhost 25

  Trying 127.0.0.1...

  Connected to localhost.localdomain (127.0.0.1).

  Escape character is '^]'.

  220 dc5test.linuxfly.org ESMTP Postfix

  ehlo localhost

  250-dc5test.linuxfly.org

  250-PIPELINING

  250-SIZE 10240000

  250-VRFY

  250-ETRN

  250-AUTH DIGEST-MD5 CRAM-MD5 NTLM LOGIN GSSAPI PLAIN

  250-AUTH=DIGEST-MD5 CRAM-MD5 NTLM LOGIN GSSAPI PLAIN

  250 8BITMIME

  mail from:"root"

  250 Ok

  rcpt to:

  250 Ok

  data

  354 End data with .

  A test mail.

  .

  250 Ok: queued as A27B38DAF

  quit

  221 Bye

  Connection closed by foreign host.

  ※內(nèi)容后的“.”號(hào)表示內(nèi)容的終結(jié)符。

  ●pop3服務(wù)

  引用

  # telnet localhost 110

  Trying 127.0.0.1...

  Connected to localhost.localdomain (127.0.0.1).

  Escape character is '^]'.

  +OK dovecot ready.

  user linuxing

  +OK

  pass password

  +OK Logged in.

  list

  +OK 1 messages:

  1 576

  retr 1

  +OK 576 octets

  Return-Path:

  X-Original-To: linuxing

  Delivered-To: linuxing@linuxfly.org

  Received: by dc5test.linuxfly.org (Postfix, from userid 0)

  id D6D728DB4; Wed, 22 Aug 2007 17:28:33 +0800 (CST)

  To: linuxing@linuxfly.org

  Subject: subject

  Message-Id: <20070822092833.D6D728DB4@dc5test.linuxfly.cn>

  Date: Wed, 22 Aug 2007 17:28:33 +0800 (CST)

  From: root@linuxfly.org (root)

  X-IMAPbase: 1187497071 28

  Status: O

  X-UID: 28

  Content-Length: 13

  X-Keywords:

  A test mail.

  quit

  +OK Logging out.

  Connection closed by foreign host.

【編輯推薦】

責(zé)任編輯:zhaolei 來(lái)源: 網(wǎng)絡(luò)轉(zhuǎn)載
相關(guān)推薦

2011-01-19 14:00:21

2010-05-07 11:55:13

Unix操作系統(tǒng)

2009-06-24 14:17:00

BackingBeanJSF配置文件

2010-01-04 10:28:47

Ubuntu Apac

2021-06-15 18:42:53

Rollup配置 JavaScript

2011-02-21 12:54:47

postfix命令

2011-02-21 13:08:37

postfix配置

2011-01-19 09:16:48

Postfix配置

2010-06-02 17:36:31

postfix概述

2011-01-13 16:27:26

Linux配置文件

2012-02-06 13:34:49

HibernateJava

2010-12-28 16:35:32

Outlook 配置文

2011-01-19 09:55:27

postfix

2010-02-04 13:43:26

Linux vsFTP

2010-02-24 14:50:33

Ubuntu vim

2025-04-09 08:05:00

運(yùn)維告警Prometheus

2010-06-07 11:22:28

2011-02-21 11:14:47

Postfix配置

2010-12-27 14:59:31

Outlook 配置文

2009-09-22 10:23:15

Hibernate配置
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 亚洲欧美日韩国产 | 日本一区二区三区在线观看 | 国产亚洲一区二区三区在线 | 午夜精品久久久久久久99黑人 | 国产精品日韩欧美一区二区三区 | 一区二区三区精品视频 | 国产高清在线精品 | av一二三四 | 久久不射电影网 | 欧美激情精品久久久久久 | 欧美日韩国产中文 | 毛片免费观看视频 | 亚洲国产高清高潮精品美女 | 久久久www| 国产精品7777777 | 国产精品自产拍 | 久久网日本 | 欧美一级大片 | 欧美日韩久久久久 | 久久久蜜桃 | 日韩中文字幕免费在线 | 国产真实精品久久二三区 | 黄色在线播放视频 | 羞羞在线视频 | 免费在线成人网 | 高清视频一区二区三区 | 国产丝袜一区二区三区免费视频 | 2一3sex性hd | 亚洲网站观看 | 成人免费一区二区三区牛牛 | 日韩色图在线观看 | 久久99精品国产 | 亚洲天堂中文字幕 | 懂色中文一区二区三区在线视频 | 国产精品一级在线观看 | av网站免费在线观看 | 二区不卡 | 精品综合网 | 一级欧美黄色片 | 国产一级片 | 欧美xxxx色视频在线观看免费 |