如果 maildir 不存在,dovecot 会给出错误

如果 maildir 不存在,dovecot 会给出错误

这与大多数用户的愿望相反,但如果 maildir 不存在,我怎样才能让 dovecot 给出错误,而不是默默地自动创建它?

Auth 是基于 pam 的,并且我在自定义目录中使用 Maildir:

mail_location = maildir:/stor/mail/imap/%u:INDEX=/stor/mail/imap/indexes/%u

如果我rm -rf /stor/mail/imap这样认为,我预计 dovecot 在启动时或至少在用户尝试获取时会发出抱怨。然而,它启动得很好,没有创建任何目录,然后/stor/mail/imap/foo在用户foo登录和获取时自动创建。

如果不存在,我希望启动失败/stor/mail/imap,或者启动失败,并在尝试获取时向用户投诉。

编辑:我可以chown root /stor/mail/imap; chmod 700 /stor/mail/imap。Dovecot 仍然启动正常(grrr)。它在获取时确实向用户发出了抱怨,尽管错误是“登录服务器失败”,这是不准确的,但比沉默要好。

我确实尝试在邮箱定义中设置autono但无济于事。似乎您无法设置autoINBOX。我使用的是 Ubuntu 16.04.2 的默认 dovecot 配置,其中conf.d/15-mailboxes.conf有:

# NOTE: Assumes "namespace inbox" has been defined in 10-mail.conf.
namespace inbox {
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Trash {
    special_use = \Trash
  }
  mailbox Sent {
    special_use = \Sent
  }
}

并且conf.d/10-mail.conf具有:

namespace inbox {
  # Namespace type: private, shared or public
  #type = private

  # Hierarchy separator to use. You should use the same separator for all
  # namespaces or some clients get confused. '/' is usually a good one.
  # The default however depends on the underlying mail storage format.
  #separator =.

  # Prefix required to access this namespace. This needs to be different for
  # all namespaces. For example "Public/".
  #prefix =.

  # Physical location of the mailbox. This is in same format as
  # mail_location, which is also the default for it.
  #location =

  # There can be only one INBOX, and this setting defines which namespace
  # has it.
  inbox = yes

  # If namespace is hidden, it's not advertised to clients via NAMESPACE
  # extension. You'll most likely also want to set list=no. This is mostly
  # useful when converting from another server with different namespaces which
  # you want to deprecate but still keep working. For example you can create
  # hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/".
  #hidden = no

  # Show the mailboxes under this namespace with LIST command. This makes the
  # namespace visible for clients that don't support NAMESPACE extension.
  # "children" value lists child mailboxes, but hides the namespace prefix.
  #list = yes

  # Namespace handles its own subscriptions. If set to "no", the parent
  # namespace handles them (empty prefix should always have this as "yes")
  #subscriptions = yes

  # See 15-mailboxes.conf for definitions of special mailboxes.
}

相关内容