免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8426 | 回复: 4

[Mail] chdir maildir failed 问题,知道的给指点一下,谢谢 [复制链接]

论坛徽章:
0
发表于 2007-09-14 18:33 |显示全部楼层
我用 telnet localhost 1100
[root@test named]# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user test@test.com
+OK Password required.
pass test
-ERR chdir Maildir failed
Connection closed by foreign host.

查看maillog 日志:
Sep 14 18:30:01 test pop3d: Connection, ip=[127.0.0.1]
Sep 14 18:30:12 test pop3d: chdir Maildir: No such file or directory

我又用 authtest -s smtp test@test.com test 命令测试
Authentication succeeded.

     Authenticated: test@test.com  (uid 503, gid 503)
    Home Directory: /var/mailbox/test.com/test/Maildir/
           Maildir: (none)
             Quota: (none)
Encrypted Password: $1$vvLPd2ie$tBBo8GXTjD0L30QYy2yA./
Cleartext Password: test
           Options: (none)

但是我看过,在我的邮件目录下是存在 Maildir 目录的,为什么还会提示没有呢?

[ 本帖最后由 liheng 于 2007-9-14 18:45 编辑 ]

论坛徽章:
0
发表于 2007-09-14 18:38 |显示全部楼层
我的环境是 FC5+Mysql+Apache+PHP+Postfix+Cyrus-Sasl+Courier-authlib+Courier-imap
下面是我的配置文档,麻烦大家帮我看一下有没有什么问题:
1、 安装mysql
[root @ test root] # groupadd mysql
[root @ test root] # useradd -g mysql mysql
[root @ test root] # tar xzvf mysql-5.0.45.tar.gz
[root @ test root] # cd mysql-5.0.45
[root @ test mysql-5.0.45] # ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=gbk
[root @ test mysql-5.0.45] # make
[root @ test mysql-5.0.45] # make install
[root @ test mysql-5.0.45] # cp support-files/my-medium.cnf /etc/my.cnf
设置自启动
[root @ test mysql-5.0.45] # cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root @ test mysql-5.0.45] # chmod 755 /etc/rc.d/init.d/mysqld
[root @ test mysql-5.0.45] # chkconfig —add mysqld
[root @ test mysql-5.0.45] #  chkconfig --level 35 mysqld on
初始化数据库
[root @ test mysql-5.0.45] # cd /usr/local/mysql
[root @ test mysql] # /usr/local/mysql/bin/mysql_install_db —user=mysql
[root @ test mysql] # chown -R root .
[root @ test mysql] #  chown -R mysql var
[root @ test mysql] # chgrp -R mysql .
安装 openssl
[root @ test root] # tar xzvf openssl-0.9.8d.tar.gz
[root @ test root] # cd openssl-0.9.8d
[root @ test openssl-0.9.8d] #  ./config shared zlib
[root @ test openssl-0.9.8d] # make
[root @ test openssl-0.9.8d] # make install
[root @ test openssl-0.9.8d] # mv /usr/bin/openssl /usr/bin/openssl.OFF
[root @ test openssl-0.9.8d] # mv /usr/include/openssl /usr/include/openssl.OFF
[root @ test openssl-0.9.8d] #  mv /usr/lib/libssl.so /usr/lib/libssl.so.OFF
[root @ test openssl-0.9.8d] # ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
[root @ test openssl-0.9.8d] # ln -s /usr/local/ssl/include/openssl /usr/include/openssl
[root @ test openssl-0.9.8d] # ln -sv /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
[root @ test openssl-0.9.8d] #  vi /etc/ld.so.conf
在最后一行添加下面这一句
/usr/lcoal/ssl/lib
[root @ test openssl-0.9.8d] # ldconfig -v
验证 openssl 的安装
[root @ test openssl-0.9.8d] # openssl version
[root @ test openssl-0.9.8d] #  rm -rf /usr/local/lib/sasl2/
[root @ test openssl-0.9.8d] # rm -rf /usr/lib/sasl2
2、安装 cyrus-sasl
[root @ test root] # tar xzvf cyrus-sasl-2.1.22.tar.gz
[root @ test root] #  cd cyrus-sasl-2.1.22
[root @ test cyrus-sasl-2.1.22] #  ./configure --prefix=/usr/local/sasl2  --disable-gssapi --disable-anon --disable-sample --disable-digest --disable-plain --disable-login --enable-sql --with-mysql=/usr/local/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-authdaemond=/usr/local/var/spool/authdaemon/socket
[root @ test cyrus-sasl-2.1.22] # make
[root @ test cyrus-sasl-2.1.22] # make install
[root @ test cyrus-sasl-2.1.22] # ln -sv /usr/local/sasl2/lib/* /usr/lib
[root @ test cyrus-sasl-2.1.22] # ln -sv /usr/local/sasl2/lib/* /usr/local/lib
[root @ test cyrus-sasl-2.1.22] #  ln -sv /usr/local/sasl2/include/sasl/* /usr/local/include
[root @ test cyrus-sasl-2.1.22] # mkdir -pv /var/state/saslauthd
[root @ test cyrus-sasl-2.1.22] #  /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
[root @ test cyrus-sasl-2.1.22] # echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf
[root @ test cyrus-sasl-2.1.22] #  echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.con
[root @ test cyrus-sasl-2.1.22] # ldconfig
开机自启动
[root @ test cyrus-sasl-2.1.22] # echo "/usr/local/sasl2/sbin/saslauthd -a shadow pam" >> /etc/rc.local
3、安装BerkeleyDB
[root @ test root] # tar xzvf db-4.5.20.tar.gz
[root @ test root] # cd db-4.5.20/build_unix
[root @ test build_unix] # ../dist/configure —prefix=/usr/local/BerkeleyDB
[root @ test build_unix] #  make
[root @ test build_unix] # make install
[root @ test build_unix] # mv /usr/include/db4 /usr/include/db4.OFF
[root @ test build_unix] #  rm /usr/include/db_cxx.h
[root @ test build_unix] #  rm -rf /usr/include/db.h
[root @ test build_unix] #  rm -rf /usr/include/db_185.h
[root @ test build_unix] #  ln -s /usr/local/BerkeleyDB/include /usr/include/db4

[root @ test build_unix] #  ln -s /usr/local/BerkeleyDB/include/db.h /usr/include/db.h
[root @ test build_unix] # ln -s /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h
[root @ test build_unix] # echo "/usr/local/BerkeleyDB/lib/" >> /etc/ld.so.conf
[root @ test build_unix] # ldconfig
4、安装Apache
[root @ test root] # tar xzvf httpd-2.2.4.tar.gz
[root @ test root] #  cd httpd-2.2.4
[root @ test httpd-2.2.4] # ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --with-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon
[root @ test httpd-2.2.4] # make
[root @ test httpd-2.2.4] # make install
设置开机自启动
[root @ test httpd-2.2.4] #  echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
5、安装 php
[root @ test root] # tar xzvf php-5.2.3.tar.gz
[root @ test root] # cd php-5.2.3
[root @ testphp-5.2.3] # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-xml --with-png --with-jpeg --with-zlib --with-freetype --with-gd --enable-track-vars --enable-mbstring=all
[root @ testphp-5.2.3] # make
[root @ testphp-5.2.3] # make install
[root @ testphp-5.2.3] # cp php.ini-dist /usr/local/php/lib/php.in
[root @ testphp-5.2.3] # vi /usr/local/apache/conf/httpd.conf
将DocumentRoot "/usr/local/apache/htdocs”
改成
DocumentRoot "/var/www"
将DocumentRoot "/usr/local/apache/htdocs"
改成
DocumentRoot "/var/www"
在<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
添加 index.php
在AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
6、安装postfix
[root @ test root] # tar xzvf postfix-2.4.5.tar.gz
[root @ test root] # cd postfix-2.4.5
[root @ test postfix-2.4.5] #  make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/sasl2/include/sasl -I/usr/local/BerkeleyDB/include -DUSE_TLS -I/usr/local/ssl/include/openssl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/local/sasl2/lib -lsasl2 -L/usr/local/BerkeleyDB/lib -L/usr/local/ssl/lib -lssl -lcrypto'
[root @ test postfix-2.4.5] # make
[root @ test postfix-2.4.5] # make install
[root @ test postfix-2.4.5] # vi /etc/postfix/main.cf
#=======================Virtual settings=============================
virtual_mailbox_base = /var/mailbox
virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:503
virtual_gid_maps = static:503
virtual_transport = virtual
maildrop_destination_recipient_limit = 1
maildrop_destination_concurrency_limit = 1
#=============================QUOTA====================================
message_size_limit = 14336000
virtual_mailbox_limit = 20971520
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota,please try again later.
virtual_overquota_bounce = yes
#============================SASL=======================================
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
        permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_sender_domain,
        reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_pipelining,
        reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner = $myhostname ESMTP "Version not Available"
[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_alias_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address

[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_domains_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = description
where_field = domain
#additional_conditions = and backupmx = '0' and active = '1'

[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf

user = extmail
password = extmail
hosts = localhost
dbname = extmail
tables = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'

[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'

[root @ test postfix-2.4.5] #  vi /usr/local/etc/authlib/authmysqlrc
MYSQL_SERVER            localhost
MYSQL_USERNAME          extamail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET           /tmp/mysql.sock
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         '503"
MYSQL_GID_FIELD         '503""
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        concat('/var/mailbox/',maildir)
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD    concat('/var/mailbox/',maildir)

[root @ test postfix-2.4.5] # vi /usr/local/etc/authlib/authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
配置 smtp 论证
[root @ test postfix-2.4.5] #  vi /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond: /usr/local/var/spool/authdaemon/socket
7、安装 extmail
[root @ test root] # tar xzvf extmail-1\[1\].0.2.tar.gz
[root @ test root] # mkdir -p /var/www/extsuite
[root @ test root] #  mv extmail-1.0.2 /var/www/extsuite/extmail
[root @ test root] # cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
修改主配置文件
[root @ test root] #
将 SYS_USER_LANG = us_EN
改成
SYS_USER_LANG = zh_CN
将SYS_MAILDIR_BASE = /home/domains
改成
SYS_MAILDIR_BASE = /var/mailbox

SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
改成
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail

SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
改成
SYS_MYSQL_SOCKET = /tmp/mysql.sock

SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
改成
SYS_AUTHLIB_SOCKET = /usr/local/var/spool/authdaemon/socket
[root @ test root] #  vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
    DocumentRoot /var/www/extsuite/extmail/html
    ServerName mail.test.com
    Alias /extmail /var/www/extsuite/extmail/html
    ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
    SuexecUserGroup postfix postfix
</VirtualHost>
[root @ test root] # chown -R postfix:postfix /var/www/extsuite/extmail/cgi
[root @ test root] # vi /usr/local/apache/conf/httpd.conf

User daemon
Group daemon
修改成
User postfix
Group postfix

[root @ test root] #  tar xzvf Desktop/Unix-Syslog-0.100.tar.gz
[root @ test root] # cd Unix-Syslog-0.100
[root @ test Unix-Syslog-0.100] #  perl Makefile.PL
[root @ test Unix-Syslog-0.100] # make
[root @ test Unix-Syslog-0.100] # make install
[root @ test root] # tar Desktop/DBD-mysql-3.0002_5.tar.gz
[root @ test root] # cd DBD-mysql-3.0002_5
[root @ test DBD-mysql-3.0002_5] # perl Makefile.PL
[root @ test DBD-mysql-3.0002_5] # make
[root @ test DBD-mysql-3.0002_5] # make install


安装 courier-authlib
[root @ test root] #  tar xvf courier-authlib-0.58.tar.tar
[root @ test root] #    cd courier-authlib-0.58
[root @ test courier-authlib-0.58] #  ./configure  --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --with-authmysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-redhat
[root @ test courier-authlib-0.58] # make
[root @ test courier-authlib-0.58] # make install
[root @ test courier-authlib-0.58] # cd /usr/local/courier-authlib/etc/authlib/
[root @ test authlib] # cp authdaemonrc.dist authdaemonrc
[root @ test authlib] # cp authmysqlrc.dist authmysqlrc
[root @ test authlib] # vi authmysqlrc
MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET           /tmp/mysql.sock
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         '503'
MYSQL_GID_FIELD         '503'
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        concat('/var/mailbox/',maildir)
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD    concat('/var/mailbox/',maildir)
[root @ test authlib] # vi authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
[root @ test authlib] # cd /root/coureier-authlib-0.58
[root @ test courier-authlib-0.58] #  cp courier-authlib.sysvinit /etc/init.d/courier-authlib
[root @ test courier-authlib-0.58] #  chmod 755 /etc/init.d/courier-authlib
[root @ test courier-authlib-0.58] # echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf
[root @ test courier-authlib-0.58] # ldconfig

安装 courier-imap
[root @ test root] # tar jxvf courier-imap-4.1.3.tar.bz2
[root @ test root] #  cd courier-imap-4.1.3
[root @ test courier-imap-4.1.3] # ./configure --prefix=/usr/local/imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS='-I/usr/local/ssl/include/openssl -I/usr/local/courier-authlib/include'
[root @ test courier-imap-4.1.3] # make
[root @ test courier-imap-4.1.3] # make install
[root @ test courier-imap-4.1.3] # cd /usr/local/imap/etc
[root @ test etc] #  cp imapd.dist imapd
[root @ test etc] # p imapd-ssl.dist imapd-ssl
[root @ test etc] # cp pop3d.dist pop3d
[root @ test etc] # cp pop3d.dist pop3d
[root @ test etc] # vi pop3d
POP3DSTART=YES
[root @ test etc] # vi imapd
[root @ test etc] # cd /root/courier-imap-4.1.3
[root @ test courier-imap-4.1.3] #  cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd

[ 本帖最后由 liheng 于 2007-9-14 18:48 编辑 ]

论坛徽章:
0
发表于 2007-09-17 21:36 |显示全部楼层

论坛徽章:
0
发表于 2007-09-17 23:58 |显示全部楼层
楼主能否贴出你的目录结构,确认你的目录存在,确认权限正确

可以参照如下:
MailDir 如何產生?正常情況下,當設定 Courier IMAP 利用 OpenLDAP 帳號認證成功的話,只要使用者收到 mail 則系統會自動在該使用者家目錄下建立 MailDir 資料夾(裡面又包含三個資料夾 cur,new,tmp),當然若無法順利建立的話你也可手動幫使用者建立 MailDir 資料夾

正常情況下使用者收到 mail 後可以看到 maillog 有如下訊息

Aug 26 13:28:13 ldap postfix/local[51429]: AC1105C3A: to=<weithenn@mail.weithenn.idv.tw>, relay=local, delay=1.1, delays=1/0.01/0/0.09, dsn=2.0.0, status=sent (delivered to maildir)      //此時 Maildir 資料夾同步建立
如何手動建立 MailDir 可參考[/url]步驟大致如下

#cd /home/user/weithenn             //切換到使用者家目錄
#maildirmake Maildir                //建立使用者 MailDir 資料夾
#chown -R weithenn Maildir          //更改為該使用者可存取權限
#cd /home/user/weithenn/Maildir;ll //列出 MailDir 下相關資料夾 total 6 drwx------   2
weithenn   weithenn   512   8 11 15:20 cur drwx------   2
weithenn   weithenn   512   8 11 15:20 new drwx------   2
weithenn   weithenn   512   8 11 15:20 tmp

以上摘至:[url]http://hi.baidu.com/agoods/blog/item/6785ebfe24632d305c6008dc.html


[ 本帖最后由 boyhyc 于 2007-9-18 00:01 编辑 ]

论坛徽章:
0
发表于 2007-09-18 17:42 |显示全部楼层
确认/var/mailbox/test.com/test/Maildir/里有文件夹new,cur, tmp和test.com及其字文件夹的所有者是postfix并有读写权限
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP