[Dovecot] How to create home directories for virtual users?
Hello,
I,m using Dovecot 1.2.9, now finishing a migration from Courier IMAP. Documentation (http://wiki.dovecot.org/VirtualUsers/Home) says that home directory should not be the same as mail directory. When I create new user accounts with PostfixAdmin the mail directory is not a problem but is there some smart way to create the home directory as well (locating it for instance in '/srv/vmail/%d/%n/home')?
Regards, Olli
On Nov 24, 2011 4:22 AM, "Olli Räisänen" olli.raisanen@telemail.fi wrote:
Hello,
I,m using Dovecot 1.2.9, now finishing a migration from Courier IMAP. Documentation (http://wiki.dovecot.org/VirtualUsers/Home) says that home directory should not be the same as mail directory. When I create new user accounts with PostfixAdmin the mail directory is not a problem but is
there
some smart way to create the home directory as well (locating it for instance in '/srv/vmail/%d/%n/home')?
Why do you need a home directory for virtual users?
Simon
On 24.11.2011, at 16.42, Simon Brereton wrote:
Documentation (http://wiki.dovecot.org/VirtualUsers/Home) says that home
Why do you need a home directory for virtual users?
It says right there in the wiki.
El 24/11/11 15:42, Simon Brereton escribió:
On Nov 24, 2011 4:22 AM, "Olli Räisänen"olli.raisanen@telemail.fi wrote:
Hello,
I,m using Dovecot 1.2.9, now finishing a migration from Courier IMAP. Documentation (http://wiki.dovecot.org/VirtualUsers/Home) says that home directory should not be the same as mail directory. When I create new user accounts with PostfixAdmin the mail directory is not a problem but is
there
some smart way to create the home directory as well (locating it for instance in '/srv/vmail/%d/%n/home')?
Why do you need a home directory for virtual users?
For storing files wich are not mails. Sieve rules, subscription files and so on.
Aaaaaaaaaaaagur.
On 24-11-11 10:22, Olli Räisänen wrote:
Hello,
I,m using Dovecot 1.2.9, now finishing a migration from Courier IMAP. Documentation (http://wiki.dovecot.org/VirtualUsers/Home) says that home directory should not be the same as mail directory. When I create new user accounts with PostfixAdmin the mail directory is not a problem but is there some smart way to create the home directory as well (locating it for instance in '/srv/vmail/%d/%n/home')?
How about using /srv/vmail/%d/%n for homedir, and /srv/vmail/%d/%n/mail as mailstore?
Otherwise, postfixadmin has a post-create hook that is able to execute arbitrary scripts, creating homedirs should be among the included examples.
-- Tom
Tom Hendrikx kirjoitti 2011-11-24 kello 18:13:47:
How about using /srv/vmail/%d/%n for homedir, and /srv/vmail/%d/%n/mail as mailstore?
Well, yes - at least the home directory will be created that way. Still, PostfixAdmin will not store the path in the maibox table home field. Perhaps it is enough to include the path in the Dovecot user_query?
Otherwise, postfixadmin has a post-create hook that is able to execute arbitrary scripts, creating homedirs should be among the included examples.
If you are referring to maildir_name_hook in config.inc.php script, no, homedirs are not included (in Postfix Admin version 2.3.4).
Thank you anyway, Tom! I must consider your advice. Olli
On Thu, 2011-11-24 at 21:23 +0200, Olli Räisänen wrote:
Tom Hendrikx kirjoitti 2011-11-24 kello 18:13:47:
How about using /srv/vmail/%d/%n for homedir, and /srv/vmail/%d/%n/mail as mailstore?
Well, yes - at least the home directory will be created that way. Still, PostfixAdmin will not store the path in the maibox table home field. Perhaps it is enough to include the path in the Dovecot user_query?
It would be better if you used PostfixAdmin's "maildir" field as the home directory, and then mail_location=~/Maildir. Like the sql queries being:
password_query =
SELECT username AS user, password,
CONCAT('/home/vmail/', maildir) AS userdb_home,
CONCAT('*:bytes=', quota) AS userdb_quota_rule
FROM mailbox
WHERE username = '%u' and ACTIVE = '1'
user_query =
SELECT CONCAT('/home/vmail/', maildir) AS home,
CONCAT('*:bytes=', quota) AS quota_rule
FROM mailbox
WHERE username = '%u' AND active = '1'
I used these in another PostfixAdmin server's install.
On 24-11-11 20:29, Timo Sirainen wrote:
On Thu, 2011-11-24 at 21:23 +0200, Olli Räisänen wrote:
Tom Hendrikx kirjoitti 2011-11-24 kello 18:13:47:
How about using /srv/vmail/%d/%n for homedir, and /srv/vmail/%d/%n/mail as mailstore?
Well, yes - at least the home directory will be created that way. Still, PostfixAdmin will not store the path in the maibox table home field. Perhaps it is enough to include the path in the Dovecot user_query?
It would be better if you used PostfixAdmin's "maildir" field as the home directory, and then mail_location=~/Maildir. Like the sql queries being:
password_query =
SELECT username AS user, password,
CONCAT('/home/vmail/', maildir) AS userdb_home,
CONCAT('*:bytes=', quota) AS userdb_quota_rule
FROM mailbox
WHERE username = '%u' and ACTIVE = '1'user_query =
SELECT CONCAT('/home/vmail/', maildir) AS home,
CONCAT('*:bytes=', quota) AS quota_rule
FROM mailbox
WHERE username = '%u' AND active = '1'I used these in another PostfixAdmin server's install.
I even simplified this up to:
# taken from stock dovecot2 config userdb { driver = static args = uid=vmail gid=mail home=/var/spool/vmail/%u } mail_location = maildir:~/Maildir
password_query = SELECT username AS user, password FROM mailbox WHERE username = '%u' AND active = '1'
(no quota's, no special cases for home/mail directory configuration)
Tom
Timo Sirainen kirjoitti 2011-11-24 kello 21:29:46:
It would be better if you used PostfixAdmin's "maildir" field as the home directory, and then mail_location=~/Maildir.
Thank you, Timo! (And thank you, Tom, for the simplification example!) I never thought ~/Maildir could refer to anything but UNIX system users! :)
Timo's queries (beneath) work indeed. However, it took quite a while of testing, and I wonder if it really would cause some trouble if homedir and maildir were kept the same...
Regards, Olli
Like the sql queries being:
password_query =
SELECT username AS user, password,
CONCAT('/home/vmail/', maildir) AS userdb_home,
CONCAT('*:bytes=', quota) AS userdb_quota_rule
FROM mailbox
WHERE username = '%u' and ACTIVE = '1'user_query =
SELECT CONCAT('/home/vmail/', maildir) AS home,
CONCAT('*:bytes=', quota) AS quota_rule
FROM mailbox
WHERE username = '%u' AND active = '1'I used these in another PostfixAdmin server's install.
participants (5)
-
Joseba Torre
-
Olli Räisänen
-
Simon Brereton
-
Timo Sirainen
-
Tom Hendrikx