分类: LINUX
2011-10-30 19:48:00
dovecot+postfix+mysql
本步骤紧接postfix+mysql文档,在设置好postfix mysql后,再设置dovecot
一 安装dovecot
#yum install dovecot -y
二 设置配置文件
#cd /etc/dovecot
#vi dovecot.conf
!include conf.d/*.conf //提示设置文件位于/etc/dovecot/conf.d/目录中以“.conf”结尾的文件
#cd ../conf.d
#ls
#vi 10-mail.conf
mail_location =maildir:/home/email/%d/%n //第30行,具体参数说明请查看配置文件说明
first_valid_uid = 600 //第164行
#vi 10-auth.conf
!include auth-system.conf.ext
!include auth-sql.conf.ext //第120行,开启对sql的认证程序
#vi auth-sql.conf.ext
passdb {
driver = sql
# Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
args = /etc/dovecot/dovecot-sql.conf.ext
}
上述标记处提示参考模板文件,为此我们需到/usr/share/doc/dovecot-2.0/example-config目录下,将需要的配置文件模板复制到其指定的目录,即/etc/dovecot/dovecot-sql.conf.ext
#cd /usr/share/doc/dovecot-2.0/example-config
#ls
#cp dovecot-sql.conf.ext /etc/dovecot/
#cd /etc/dovecot
#vi dovecot-sql.conf.ext
driver = mysql //第29行
connect = host=localhost dbname=lqmsql user=vmail password=vmail //第63行
default_pass_scheme = PLAIN //第73行,plain表示为明文密码方式
password_query = \ //第102行
SELECT username, domain, password \
FROM lqm WHERE username = '%u'
user_query = SELECT mailbox, 600 AS uid, 600 AS gid FROM lqm WHERE username = '%u'
//第120行
如此设置部分完成
三 检测
# /etc/init.d/dovecot restart
#netstat -antlp
在命令行使用telnet检测
#telnet localhost 110 //110为dovecot开启的端口
依次输入如下:
user //输入后回车,出现ok字样,表明正确
pass linux4user //pass后接数据库中user@linux.org的密码
list
quit
若无法出现相关效果,请查看日志/var/log/maillog
# tail /var/log/maillog
若提示如下:
l: Unknown database driver 'mysql'
Oct 28 07:06:58 desktop20 dovecot: master: Error: service(auth): command startup failed, throttling
说明相关软件包未安装
# yum list dovecot*
查看到dovecot-mysql未安装,需手动安装它
#yum install dovecot-mysql
再次测试
#telnet localhost 110
user
pass linux4user
list
quit