内容提要:AIX上的Sendmail邮件服务器的配置及常见问题
说明:
在AIX中,包含有sendmail,当安装完系统后,启动sendmail守护进程即可,接受邮件需要启动pop3d守护进程,然后就可以用outlook,foxmai
l等常用客户端工具收发邮件了。
操作如下:
# startsrc -s sendmail -a “-bd -q30m” 把sendmail当成daemon来启动 # vi /etc/inetd.conf
找到下行并去除其前面的注释号
#pop3 stream tcp nowait root /usr/sbin/pop3d pop3d #refresh -s inetd #lssrc –t pop3d 显示如下即可
pop3 /usr/sbin/pop3d pop3d active
下面是在用sendmail时常遇的问题:
A、当需要把AIX服务器的root信箱转发到interenet个人信箱以保证及时收到系统发出的重要warning或者报错的话,需配置aliases别名,如例 :
# vi /etc/aliases
# Alias for mailer daemon MAILER-DAEMON:root
# Following alias is required by the new mail protocol, RFC 822 postmaster:root
# Aliases to handle mail to msgs and news nobody: /dev/null
# Alias to which SSA related warnings are mailed ssa_adm: root
# Alias for admin issue
root: root,test@cn.ibm.com 要使改动生效,有两种办法
(1) # sendmail -bi (2) # newaliases
当执行命令遇到如下信息时,需要检查目录的许可权限是否正确。 # newaliases
WARNING: Group writable directory /var/spool
WARNING: Group writable directory /var/spool/mqueue
/etc/mail/aliases: 5 aliases, longest 17 bytes, 78 bytes total # ls -dl /var/spool
drwxrwxr-x --12 bin --bin -- --512 Dec 19 11:26 /var/spool
# ls -dl /var/spool/mqueue
drwxrwxr-x --2 root --system --512 Mar 17 18:08 /var/spool/mqueue # chmod 755 /var/spool
# chmod 755 /var/spool/mqueue # newaliases
/etc/mail/aliases: 5 aliases, longest 17 bytes, 78 bytes total 另一种警告信息的解决
# sendmail -bi
WARNING: World writable directory /etc
dbm map \
WARNING: cannot open alias database /etc/aliases
Cannot create database for alias file /etc/aliases: A system call received a par ameter that is not valid. # ls -dl /etc
drwxrwxrwx --30 root --system ----4096 Mar 17 10:35 /etc # chmod 755 /etc # sendmail -bi
/etc/aliases: There are 4 aliases. The longest is 9 bytes, with 57 bytes total.
备注:
除此aliases全局设置方法外,我们还可以编辑用户自己属主目录下的$HOME/.forward add line with the target mail address, for example test@cn.sendmail.com
存盘退出后,凡是发到用户的信都会同时转发到test@cn.ibm.com
B、当/etc/sendmail.cf被误删除,或者被损坏,或者被改的面目全非时,如何处理?
(1) # cp /usr/lpp/bos.net/inst_root/etc/mail/sendmail.cf /etc/sendmail.cf
备注:在/usr/lpp/bos.net/inst_root/etc目录下有很多系统文件的重要拷贝,如 inetd.conf/rc.tcpip/syslog.conf 等许多许多。
(2) 重新创建 sendmail.cf(以AIX 4.3.3为例) 步骤如下:
首先我们要确认系统中存在下列文件集: bos.adt.base & bos.net.tcp.adt
AIX 将产生定制sendmail配置文件的工具和宏放在/usr/samples/tcpip/sendmail/cf 具体操作步骤如下:
#cd /usr/samples/tcpip/sendmail/cf
这里有我们需要的文件aix433.mc. 它包含我们需要定制的sendmail特性 #cp aix433.mc mysendmail.mc 创建它的一份拷贝 #vi mysendmail.mc divert(0)dnl
OSTYPE(aix43)dnl
FEATURE(genericstable)dnl
FEATURE(mailertable)dnl FEATURE(virtusertable)dnl FEATURE(domaintable)dnl FEATURE(allmasquerade)dnl
FEATURE(promiscuous_relay)dnl
FEATURE(accept_unresolvable_domains)dnl FEATURE(accept_unqualified_senders)dnl DOMAIN(generic)dnl MAILER(local)dnl MAILER(smtp)dnl MAILER(uucp)
编辑修改后如下:
#more mysendmail.mc
-------------------------------------------- divert(0)dnl
OSTYPE(aix433)dnl
FEATURE(allmasquerade)dnl DOMAIN(generic)dnl MAILER(local)dnl MAILER(smtp)dnl MAILER(uucp)
--------------------------------------------
注意:在mysendmail.mc中,注释是不起作用的,所以不需要的feature 一定要删除,否则在生成sendmail配置文件时会出错。 下面我们要创建sendmail.cf
# cd /usr/samples/tcpip/sendmail/cf
# m4 ../m4/cf.m4 mysendmail.mc > mysendmail.cf # mv mysendmail.cf /etc/sendmail.cf
C、当用mail -v发送邮件时,发现要过很长时间才能发出才回到提示符,该如何处理? # mail -v ql Subject: test Just a test . Cc:
WARNING: The local host name (r6f50) does not have a domain; fix $j in config fi le
ql... Connecting to local... ql... Sent
这个问题的产生是由于我们在sendmail.cf中并未指定域名,那么sendmail宏在处理$j时不知怎么办,那么会延长daemon的处理时间。解决办法
是使用空域名。
# vi /etc/hosts
ipaddress hostname hostname.
主要是在原来的记录上加hostname和一个点”.”然后存盘退出 # mail -v ql Subject: test Just a test . Cc:
ql... Connecting to local... ql... Sent
再次发送测试,显示问题已经解决。