[Dovecot] Autocreation the home folder
Sorry if this has been already asked, but I haven't been able to find a solution, I am trying to migrate a dovecot 1.2 config to 2.1, the 'dovecot -n > dovecot.conf' migrated all the setup without issues, and the mail is working as expected.
The only issue I've had is with the change with the mail_location, mail_home, that in the 2.1 versions can't be on the same path.
After reading in the wiki the various config options ( http://wiki2.dovecot.org/VirtualUsers/Home) I opted to use the 3rd:
Home directory under mail, for example: Maildir: home=/var/vmail/domain/user/home/ mail=/var/vmail/domain/user/ mbox: There's really no good and safe way to do it.
So I changed from: mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n To: mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n/home
The problem is that those home directories are not created (the mailboxes already existed) automatically, and I am getting these errors:
========================================================== May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Home dir not found: /var/vmail/example.com/username/home May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota root: name=User quota backend=maildir args= May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota rule: root=User quota mailbox=* bytes=20480000000 messages=0 May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota rule: root=User quota mailbox=Trash ignored May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota warning: bytes=15360000000 (75%) messages=0 reverse=no command=/etc/dovecot/quota-warning.sh 75 May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota warning: bytes=17408000000 (85%) messages=0 reverse=no command=/etc/dovecot/quota-warning.sh 85 May 10 17:08:59 server dovecot: lda(username@example.com): Debug: maildir++: root=/home/vmail/example.com/username, index=, control=, inbox=/home/vmail/example.com/username, alt= May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota root: name=User quota backend=maildir args= May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota rule: root=User quota mailbox=* bytes=1073741824 messages=0 May 10 17:08:59 server dovecot: lda(username@example.com): Debug: Quota warning: bytes=805306368 (75%) messages=0 reverse=no command=/etc/dovecot/quota-warning.sh 75
Am I supposed to create the folders via an external script? Or is there any option to make this automatic.
Regards,
Joan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
The only issue I've had is with the change with the mail_location, mail_home, that in the 2.1 versions can't be on the same path.
So I changed from: mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n
Is /home/vmail the same as /var/vmail ?
To: mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n/home
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUZCToF3r2wJMiz2NAQImegf/WaoqkBP8cMbbc/dvwx5iIUaGUWpYUYU8 oE61/rKWu2kPIVur/njDkO6YLMTzTwiedhRQgddJPlucKQ2mj5r9AGd3Y3PWsDY8 VJNeC5D9wTVzGsJgppPazdbjabz7Kjp9p3PEC6mMU2C9Ud8DXp2XlpeS20vtk7fS ItiS4xeW6SgmenJsSavB7H9Uz46/crxgoE0MP0NZG12jRce7thBxEt6Ihds/nb8G jpaEHT/R5g3Ii2quhJAJBil+R32J5T/DKxG5DVdlAhRR+mWYWAZzBlW1VYTjgffF ilP91IO2z4WCArdT3Wg+THwwo0K6uNxHRxgP9Sz73Bb3Wb1mY9IOfQ== =wALs -----END PGP SIGNATURE-----
Hi Steffen, that was an error I hadn't spotted (copypasting error). Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Debug: Home dir not found: /home/vmail/example.com/username/home
2013/5/13 Steffen Kaiser <skdovecot@smail.inf.fh-brs.de>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
The only issue I've had is with the change with the mail_location,
mail_home, that in the 2.1 versions can't be on the same path.
So I changed from: mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n
Is /home/vmail the same as /var/vmail ?
To:
mail_location = maildir:/home/vmail/%d/%n mail_home = /var/vmail/%d/%n/home
- -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUZCToF3r2wJMiz2NAQImeg**f/WaoqkBP8cMbbc/**dvwx5iIUaGUWpYUYU8 oE61/rKWu2kPIVur/**njDkO6YLMTzTwiedhRQgddJPlucKQ2**mj5r9AGd3Y3PWsDY8 VJNeC5D9wTVzGsJgppPazdbjabz7Kj**p9p3PEC6mMU2C9Ud8DXp2XlpeS20vt**k7fS ItiS4xeW6SgmenJsSavB7H9Uz46/**crxgoE0MP0NZG12jRce7thBxEt6Ihd**s/nb8G jpaEHT/R5g3Ii2quhJAJBil+**R32J5T/DKxG5DVdlAhRR+**mWYWAZzBlW1VYTjgffF ilP91IO2z4WCArdT3Wg+**THwwo0K6uNxHRxgP9Sz73Bb3Wb1mY9**IOfQ== =wALs -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error). Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is there any option to make this automatic.
As far as I know, the home directory is not created automatically. You will need to use an external script.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUZELwl3r2wJMiz2NAQISxwgAnYwXngFKs0JoLmwWr5ugUWk/AyTwJbMA eQ2zmAYPg9L1Bm82/q69oXJ0YQfuVjewH+mHlWqEQWQ87e61akpyE5CIVJDkkaTY VGgZAmaHjOFPeNj4DkLlNcSHPr7AJXfSRBAeTFGLA5cwwGs0A9iIxV6DQiKkF8QN AaZCS0JlZ3NHyka3DN+m2GCZeSERP8+G2rznz6p8WWZBgccl366I+9UQkQYKLqpi j+DU47DmQNMWvmA+7iekmTWWEIW8IDL0gk0Q1GtSYNKQA4o+trFZKZjDbL5KJpmk YLdnra+BCCM3g3NrZcOYO4degYO0dBMtMkPGrlU2jzu0W6RiMrkz3A== =j7UR -----END PGP SIGNATURE-----
El 13/05/13 17:50, Steffen Kaiser escribió:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error). Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is there any option to make this automatic.
As far as I know, the home directory is not created automatically. You will need to use an external script.
I have this config:
mail_home = /mail/users/mailboxes/%2Ln/%Ln mail_location = mdbox:%h/mdbox:INDEX=/mail/indexes/%2Ln/%Ln
In my config, mail_home is also auto created (I have dovecot 2.1.16)
Do you have any error? Has dovecot user permissions to create
direcotories/files under your /var/mail?
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
Yes, all folder tree has vmail:vmail as the owner, and dovecot can create the folders without issues. I verified that when manually creating those folders, the warnings disappear, the main issue still remains though. When I send the first mail to a user he has this layout: cur dovecot.index.cache dovecot.index.log dovecot-uidlist dovecot-uidvalidity dovecot-uidvalidity.5191f7ad maildirsize new tmp
Sadly ,there's no home folder, so I've no other option than to create the folder by hand?
2013/5/14 Angel L. Mateo <amateo@um.es>
El 13/05/13 17:50, Steffen Kaiser escribió:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error). Still
after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is
there any option to make this automatic.
As far as I know, the home directory is not created automatically. You will need to use an external script.
I have this config:
mail_home = /mail/users/mailboxes/%2Ln/%Ln mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln
In my config, mail_home is also auto created (I have dovecot
2.1.16)
Do you have any error? Has dovecot user permissions to create
direcotories/files under your /var/mail?
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
Sorry for this bump, but isn't there a better solution to have those folders than to be watching the logs for warnings and recreate them?
Regards,
Joan
2013/5/14 Joan <aseques@gmail.com>
Yes, all folder tree has vmail:vmail as the owner, and dovecot can create the folders without issues. I verified that when manually creating those folders, the warnings disappear, the main issue still remains though. When I send the first mail to a user he has this layout: cur dovecot.index.cache dovecot.index.log dovecot-uidlist dovecot-uidvalidity dovecot-uidvalidity.5191f7ad maildirsize new tmp
Sadly ,there's no home folder, so I've no other option than to create the folder by hand?
2013/5/14 Angel L. Mateo <amateo@um.es>
El 13/05/13 17:50, Steffen Kaiser escribió:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error).
Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is
there any option to make this automatic.
As far as I know, the home directory is not created automatically. You will need to use an external script.
I have this config:
mail_home = /mail/users/mailboxes/%2Ln/%Ln mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln
In my config, mail_home is also auto created (I have dovecot
2.1.16)
Do you have any error? Has dovecot user permissions to create
direcotories/files under your /var/mail?
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
Dovecot autocreates the mail directory, but apparently it doesn't currently autocreate the home directory if it's located elsewhere. I'm not sure if it's really worth the trouble to change the code to do that. Ideally the mail directory would be under the home directory and this wouldn't be a problem. You could also change your new user creation to trigger mkdiring the user's home.
On 15.5.2013, at 15.57, Joan <aseques@gmail.com> wrote:
Sorry for this bump, but isn't there a better solution to have those folders than to be watching the logs for warnings and recreate them?
Regards,
Joan
2013/5/14 Joan <aseques@gmail.com>
Yes, all folder tree has vmail:vmail as the owner, and dovecot can create the folders without issues. I verified that when manually creating those folders, the warnings disappear, the main issue still remains though. When I send the first mail to a user he has this layout: cur dovecot.index.cache dovecot.index.log dovecot-uidlist dovecot-uidvalidity dovecot-uidvalidity.5191f7ad maildirsize new tmp
Sadly ,there's no home folder, so I've no other option than to create the folder by hand?
2013/5/14 Angel L. Mateo <amateo@um.es>
El 13/05/13 17:50, Steffen Kaiser escribió:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error).
Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is
there any option to make this automatic.
As far as I know, the home directory is not created automatically. You will need to use an external script.
I have this config:
mail_home = /mail/users/mailboxes/%2Ln/%Ln mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln
In my config, mail_home is also auto created (I have dovecot
2.1.16)
Do you have any error? Has dovecot user permissions to create
direcotories/files under your /var/mail?
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
The issue is more with legacy installs being upgraded than with new setups, on the later I might adjust the settings and start using the recoomended layout. On the alternative you suggest, if I understood properly, you are changing the setup to mdbox
mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln If there was a method to move automatically the mails (preferibly not moving to mdbox) to a subfolder, I could change to the recommended layout my current install. Otherwise it seems the only current solution is to: 1.- Stop dovecot 2.- Change to recommended layout the config 3.- Via a script move the content to the new location 4.- Start dovecot with the new layout..
Am i right?
Joan
2013/5/15 Timo Sirainen <tss@iki.fi>
Dovecot autocreates the mail directory, but apparently it doesn't currently autocreate the home directory if it's located elsewhere. I'm not sure if it's really worth the trouble to change the code to do that. Ideally the mail directory would be under the home directory and this wouldn't be a problem. You could also change your new user creation to trigger mkdiring the user's home.
On 15.5.2013, at 15.57, Joan <aseques@gmail.com> wrote:
Sorry for this bump, but isn't there a better solution to have those folders than to be watching the logs for warnings and recreate them?
Regards,
Joan
2013/5/14 Joan <aseques@gmail.com>
Yes, all folder tree has vmail:vmail as the owner, and dovecot can create the folders without issues. I verified that when manually creating those folders, the warnings disappear, the main issue still remains though. When I send the first mail to a user he has this layout: cur dovecot.index.cache dovecot.index.log dovecot-uidlist dovecot-uidvalidity dovecot-uidvalidity.5191f7ad maildirsize new tmp
Sadly ,there's no home folder, so I've no other option than to create the folder by hand?
2013/5/14 Angel L. Mateo <amateo@um.es>
El 13/05/13 17:50, Steffen Kaiser escribió:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 13 May 2013, Joan wrote:
Hi Steffen, that was an error I hadn't spotted (copypasting error).
Still after changing mail_home to the proper value (/home/vmail/%d/%n/home) the errors in the logs are the same
Am I supposed to create the folders via an external script? Or is
> there any option to make this automatic. >
As far as I know, the home directory is not created automatically. You will need to use an external script.
I have this config:
mail_home = /mail/users/mailboxes/%2Ln/%Ln mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln
In my config, mail_home is also auto created (I have dovecot
2.1.16)
Do you have any error? Has dovecot user permissions to create
direcotories/files under your /var/mail?
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
El 16/05/13 12:48, Joan escribió:
The issue is more with legacy installs being upgraded than with new setups, on the later I might adjust the settings and start using the recoomended layout. On the alternative you suggest, if I understood properly, you are changing the setup to mdbox
mail_location = mdbox:%h/mdbox:INDEX=/mail/**indexes/%2Ln/%Ln If there was a method to move automatically the mails (preferibly not moving to mdbox) to a subfolder, I could change to the recommended layout my current install. Otherwise it seems the only current solution is to: 1.- Stop dovecot 2.- Change to recommended layout the config 3.- Via a script move the content to the new location 4.- Start dovecot with the new layout..
Am i right?
I think you could this without needind dovecto to be stopped. If you
could rewrite mail_location and mail_home in user's database, you could do:
For every user: 1.1. Change user's mail_location and mail_home 1.2. Change a user to recommended layout
Change the config to recommended layout
Remove per user's mail_location and mail_home config
(I'm not really sure about the right order for 1.1 and 1.2)
Another (maybe easier) suggestion... Could you just make /var/vmail a symlink to /home/vmail? This is no the ideal solution but it might works.
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
At the moment I've not yet migrated to the new schema, the install I was testing with does not have a lot of action, so at the moment I am fixing the issues when they appear (not very frequent). On the near future, will see, I can't modify the fields in the database because I am using a fixed layout, so I might use a solution based on creating hardlinks, changing configuration, and then remove the original paths... Still I haven't tested this... Will post what I have in the future..
Regards,
Joan
2013/5/17 Angel L. Mateo <amateo@um.es>
El 16/05/13 12:48, Joan escribió:
The issue is more with legacy installs being upgraded than with new
setups, on the later I might adjust the settings and start using the recoomended layout. On the alternative you suggest, if I understood properly, you are changing the setup to mdbox
mail_location = mdbox:%h/mdbox:INDEX=/mail/****indexes/%2Ln/%Ln
If there was a method to move automatically the mails (preferibly not moving to mdbox) to a subfolder, I could change to the recommended layout my current install. Otherwise it seems the only current solution is to: 1.- Stop dovecot 2.- Change to recommended layout the config 3.- Via a script move the content to the new location 4.- Start dovecot with the new layout..
Am i right?
I think you could this without needind dovecto to be stopped. If
you could rewrite mail_location and mail_home in user's database, you could do:
For every user: 1.1. Change user's mail_location and mail_home 1.2. Change a user to recommended layout
Change the config to recommended layout
Remove per user's mail_location and mail_home config
(I'm not really sure about the right order for 1.1 and 1.2) Another (maybe easier) suggestion... Could you just make
/var/vmail a symlink to /home/vmail? This is no the ideal solution but it might works.
-- Angel L. Mateo Martínez Sección de Telemática Área de Tecnologías de la Información y las Comunicaciones Aplicadas (ATICA) http://www.um.es/atica Tfo: 868887590 Fax: 868888337
participants (4)
-
Angel L. Mateo
-
Joan
-
Steffen Kaiser
-
Timo Sirainen