-- License: 0BSD.
CREATE TABLE IF NOT EXISTS users (
- username VARCHAR(128) NOT NULL,
+ username VARCHAR(128) PRIMARY KEY,
domain VARCHAR(128) NOT NULL,
password VARCHAR(64) NOT NULL,
- home VARCHAR(255) NOT NULL,
- uid INTEGER NOT NULL,
- gid INTEGER NOT NULL,
active CHAR(1) DEFAULT 'Y' NOT NULL
);
#
# <doc/wiki/MailLocation.txt>
#
-mail_location = mbox:~/mail:INBOX=/var/mail/%u
+mail_location = maildir:/var/vmail/%n
# If you need to set multiple mailbox locations or want to change default
# namespace settings, you can do it by defining namespace sections.
# System user and group used to access mails. If you use multiple, userdb
# can override these by returning uid or gid fields. You can use either numbers
# or names. <doc/wiki/UserIds.txt>
-#mail_uid =
-#mail_gid =
+mail_uid = vmail
+mail_gid = vmail
# Group to enable temporarily for privileged operations. Currently this is
# used only with INBOX when either its initial creation or dotlocking fails.
psql --dbname=mail_db --file=databases/mail/mail_db_create.sql
```
+Mailbox
+-------
+
+Use `vmail` user for virtual mailboxes.
+
+```
+$ useradd --home-dir /var/vmail --shell /usr/sbin/nologin --lock \
+ --create-home vmail
+$ touch /var/log/dovecot.log /var/log/dovecot-info.log
+$ chown vmail:vmail /var/log/{dovecot.log,dovecot-info.log}
+```
+
Administration
--------------
```
psql --username=postgres --dbname=<database> \
--command="INSERT INTO users \
-
- VALUES ('user', 'domain.com', MD5('<password>'), \
- '/home/debian', id -u, id -g)"
+ VALUES ('user', 'domain.com', MD5('<password>'))"
```
# driver = prefetch
#}
-userdb {
- driver = sql
- args = /etc/dovecot/dovecot-sql.conf.ext
-}
+#userdb {
+# driver = sql
+# args = /etc/dovecot/dovecot-sql.conf.ext
+#}
# If you don't have any user-specific settings, you can avoid the user_query
# by using userdb static instead of userdb sql, for example:
# <doc/wiki/UserDatabase.Static.txt>
-#userdb {
- #driver = static
- #args = uid=vmail gid=vmail home=/var/vmail/%u
-#}
+userdb {
+ driver = static
+ args = uid=vmail gid=vmail home=/var/vmail/%n
+}
# user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
# user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
#
-user_query = \
- SELECT home, uid, gid \
- FROM users WHERE username = '%n' AND domain = '%d' AND active = 'Y'
+#user_query = \
+# SELECT home, uid, gid \
+# FROM users WHERE username = '%n' AND domain = '%d' AND active = 'Y'
# If you wish to avoid two SQL lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll