Home Directory Creation
Hello,
I hate to have to ask this, but... why isn't the home directory being created automatically?
Due to legacy compatibility we've had to use this type of home dir config:
mail_location = maildir:/vmail/%d/%n mail_home = /vmail/%d/%n/home
We're in the middle of upgrading to new hardware, and so I'm migrating configs to the new server, Dovecot 2.3.7 and Postfix 3.4.6
On our old server (Dovecot 2.2, Postfix 2.11) the home directory gets created automatically with a new user, but not on this one. The Dovecot debug logs just say "home dir not found."
Can anyone point me in the right direction?
Thank you, Asai
Asai via dovecot skrev den 2019-10-02 03:00:
mail_location = maildir:/vmail/%d/%n mail_home = /vmail/%d/%n/home
Can anyone point me in the right direction?
https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_us...
mail_home = /var/vmail/%d/%n mail_location = maildir:~/mail
little diff
Asai via dovecot skrev den 2019-10-02 03:00:
https://doc.dovecot.org/configuration_manual/home_directories_for_virtual_us...
mail_home = /var/vmail/%d/%n mail_location = maildir:~/mail
little diff
Hello,
Thanks for replying. I understand that that's in the docs, but I had to go with another option that's listed in the docs, which is to set up the home directory under the mail directory. This is due to backwards compatibility needs.
Asai
On 2.10.2019 4.00, Asai via dovecot wrote:
Hello,
I hate to have to ask this, but... why isn't the home directory being created automatically?
Due to legacy compatibility we've had to use this type of home dir config:
mail_location = maildir:/vmail/%d/%n mail_home = /vmail/%d/%n/home
We're in the middle of upgrading to new hardware, and so I'm migrating configs to the new server, Dovecot 2.3.7 and Postfix 3.4.6
On our old server (Dovecot 2.2, Postfix 2.11) the home directory gets created automatically with a new user, but not on this one. The Dovecot debug logs just say "home dir not found."
Can anyone point me in the right direction?
Thank you, Asai
Can you configure mail_debug=yes, try again, and post the logs?
Aki
On 10/1/2019 11:42 PM, Aki Tuomi via dovecot wrote:
Can you configure mail_debug=yes, try again, and post the logs?
Aki
Hello Aki,
This is the only piece of relevant info I've been getting in the logs, and I'm trying to figure out how I can get more debug data on this:
Oct 02 07:34:09 imap(asai2@triata.globalchange.media)<43553><9fylXO6TtycKCgDu>: Debug: Home dir not found: /vmail/triata.globalchange.media/asai2/home
Hello,
I spent the afternoon troubleshooting this, and after hours, I still can't see what I'm missing.
On the older version of Dovecot (2.2) it worked fine to create a new user, then Dovecot would create the home folder under the maildir folder as outlined in the documentation, simply by creating a new user in the database, and opening the new user account in the mail client.
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 (7372921a) # Hostname: triata4 auth_debug = yes auth_debug_passwords = yes auth_mechanisms = plain login auth_verbose = yes auth_verbose_passwords = plain debug_log_path = /var/log/dovecot-debug.log deliver_log_format = msgid=%m: from=%f: %$ hostname = triata.globalchange.media info_log_path = /var/log/dovecot-info.log mail_debug = yes mail_fsync = always mail_home = /vmail/%d/%n/home mail_location = maildir:/vmail/%d/%n managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = separator = / type = private } passdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } plugin { mail_log_fields = uid box msgid from flags sieve = file:/vmail/%d/%n/home/sieve;active=/vmail/%d/%n/home/.dovecot.sieve sieve_after = /etc/dovecot/sieve/junk-spam.sieve sieve_before = /etc/dovecot/sieve/junk-spam.sieve sieve_dir = /vmail/%d/%n/home/sieve } protocols = imap lmtp sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-master { group = vmail mode = 0660 user = vmail } unix_listener auth-userdb { group = vmail mode = 0666 user = vmail } user = root } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } process_min_avail = 0 service_count = 1 vsz_limit = 64 M } service managesieve { process_limit = 1024 } service stats { unix_listener stats-reader { group = vmail mode = 0660 user = vmail } unix_listener stats-writer { group = vmail mode = 0660 user = vmail } } ssl_cert = </etc/letsencrypt/live/triata.globalchange.media/fullchain.pem ssl_key = # hidden, use -P to show it submission_relay_host = triata.globalchange.media submission_relay_port = 587 submission_relay_ssl = starttls submission_relay_trusted = yes userdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } protocol lmtp { mail_plugins = " sieve" } protocol lda { mail_plugins = }
Mr. Timo,
I would presume you are busy with many responsibilities, but might you have a few minutes to consider this problem?
Or is there any other Dovecot expert who may be able to offer advice on how to get the home directories created? Thank you for those who have helped offer advice on this already.
Asai
On 10/2/2019 5:08 PM, Asai via dovecot wrote:
Hello,
I spent the afternoon troubleshooting this, and after hours, I still can't see what I'm missing.
On the older version of Dovecot (2.2) it worked fine to create a new user, then Dovecot would create the home folder under the maildir folder as outlined in the documentation, simply by creating a new user in the database, and opening the new user account in the mail client.
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 (7372921a) # Hostname: triata4 auth_debug = yes auth_debug_passwords = yes auth_mechanisms = plain login auth_verbose = yes auth_verbose_passwords = plain debug_log_path = /var/log/dovecot-debug.log deliver_log_format = msgid=%m: from=%f: %$ hostname = triata.globalchange.media info_log_path = /var/log/dovecot-info.log mail_debug = yes mail_fsync = always mail_home = /vmail/%d/%n/home mail_location = maildir:/vmail/%d/%n managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = separator = / type = private } passdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } plugin { mail_log_fields = uid box msgid from flags sieve = file:/vmail/%d/%n/home/sieve;active=/vmail/%d/%n/home/.dovecot.sieve sieve_after = /etc/dovecot/sieve/junk-spam.sieve sieve_before = /etc/dovecot/sieve/junk-spam.sieve sieve_dir = /vmail/%d/%n/home/sieve } protocols = imap lmtp sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-master { group = vmail mode = 0660 user = vmail } unix_listener auth-userdb { group = vmail mode = 0666 user = vmail } user = root } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } process_min_avail = 0 service_count = 1 vsz_limit = 64 M } service managesieve { process_limit = 1024 } service stats { unix_listener stats-reader { group = vmail mode = 0660 user = vmail } unix_listener stats-writer { group = vmail mode = 0660 user = vmail } } ssl_cert = </etc/letsencrypt/live/triata.globalchange.media/fullchain.pem ssl_key = # hidden, use -P to show it submission_relay_host = triata.globalchange.media submission_relay_port = 587 submission_relay_ssl = starttls submission_relay_trusted = yes userdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } protocol lmtp { mail_plugins = " sieve" } protocol lda { mail_plugins = }
On 03/10/2019 17:26, Asai via dovecot wrote:
Mr. Timo,
I would presume you are busy with many responsibilities, but might you have a few minutes to consider this problem?
Or is there any other Dovecot expert who may be able to offer advice on how to get the home directories created? Thank you for those who have helped offer advice on this already.
Tried your config here and it works. My debug log looks as follows for the first brief IMAP session:
Oct 3 22:28:56 drieka dovecot: imap-login: Login: user=<diederik-jan>, method=PLAIN, rip=::1, lip=::1, mpid=21949, secured, session=<OtQjbweUvpIAAAAAAAAAAAAAAAAAAAAB> Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Added userdb setting: plugin/=yes Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Effective uid=1001, gid=1001, home=/vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Home dir not found: /vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace inbox: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/vmail//diederik-jan Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: maildir++: root=/vmail//diederik-jan, index=, indexpvt=, control=, inbox=/vmail//diederik-jan, alt= Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : /vmail//diederik-jan doesn't exist yet, using default permissions Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : Using permissions from /vmail//diederik-jan: mode=0700 gid=default Oct 3 22:29:02 drieka dovecot: imap(diederik-jan): Debug: INBOX: Mailbox opened because: SELECT Oct 3 22:29:04 drieka dovecot: imap(diederik-jan): Logged out in=31 out=747
Took me a few tries to get this working though. You need to configure the permissions of /vmail correctly. Are you sure you're looking in the correct log file for finding errors?
You can execute the following to find out:
$ sudo doveadm log find Looking for log files from /var/log Debug: /var/log/syslog Debug: /var/log/mail.log Info: /var/log/syslog Info: /var/log/mail.info Info: /var/log/mail.log Warning: /var/log/mail.warn Warning: /var/log/syslog Warning: /var/log/mail.info Warning: /var/log/mail.log Error: /var/log/mail.warn Error: /var/log/syslog Error: /var/log/mail.info Error: /var/log/mail.err Error: /var/log/mail.log Fatal: /var/log/mail.warn Fatal: /var/log/syslog Fatal: /var/log/mail.info Fatal: /var/log/mail.err Fatal: /var/log/mail.log
Regards,
Stephan.
Asai
On 10/2/2019 5:08 PM, Asai via dovecot wrote:
Hello,
I spent the afternoon troubleshooting this, and after hours, I still can't see what I'm missing.
On the older version of Dovecot (2.2) it worked fine to create a new user, then Dovecot would create the home folder under the maildir folder as outlined in the documentation, simply by creating a new user in the database, and opening the new user account in the mail client.
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf # Pigeonhole version 0.5.7.2 (7372921a) # Hostname: triata4 auth_debug = yes auth_debug_passwords = yes auth_mechanisms = plain login auth_verbose = yes auth_verbose_passwords = plain debug_log_path = /var/log/dovecot-debug.log deliver_log_format = msgid=%m: from=%f: %$ hostname = triata.globalchange.media info_log_path = /var/log/dovecot-info.log mail_debug = yes mail_fsync = always mail_home = /vmail/%d/%n/home mail_location = maildir:/vmail/%d/%n managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace inbox { inbox = yes location = mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix = separator = / type = private } passdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } plugin { mail_log_fields = uid box msgid from flags sieve = file:/vmail/%d/%n/home/sieve;active=/vmail/%d/%n/home/.dovecot.sieve sieve_after = /etc/dovecot/sieve/junk-spam.sieve sieve_before = /etc/dovecot/sieve/junk-spam.sieve sieve_dir = /vmail/%d/%n/home/sieve } protocols = imap lmtp sieve service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-master { group = vmail mode = 0660 user = vmail } unix_listener auth-userdb { group = vmail mode = 0666 user = vmail } user = root } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0660 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } process_min_avail = 0 service_count = 1 vsz_limit = 64 M } service managesieve { process_limit = 1024 } service stats { unix_listener stats-reader { group = vmail mode = 0660 user = vmail } unix_listener stats-writer { group = vmail mode = 0660 user = vmail } } ssl_cert = </etc/letsencrypt/live/triata.globalchange.media/fullchain.pem ssl_key = # hidden, use -P to show it submission_relay_host = triata.globalchange.media submission_relay_port = 587 submission_relay_ssl = starttls submission_relay_trusted = yes userdb { args = /etc/dovecot/dovecot-mysql.conf driver = sql } protocol lmtp { mail_plugins = " sieve" } protocol lda { mail_plugins = }
Tried your config here and it works. My debug log looks as follows for the first brief IMAP session:
Oct 3 22:28:56 drieka dovecot: imap-login: Login: user=<diederik-jan>, method=PLAIN, rip=::1, lip=::1, mpid=21949, secured, session=<OtQjbweUvpIAAAAAAAAAAAAAAAAAAAAB> Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Added userdb setting: plugin/=yes Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Effective uid=1001, gid=1001, home=/vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Home dir not found: /vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace inbox: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/vmail//diederik-jan Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: maildir++: root=/vmail//diederik-jan, index=, indexpvt=, control=, inbox=/vmail//diederik-jan, alt= Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : /vmail//diederik-jan doesn't exist yet, using default permissions Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : Using permissions from /vmail//diederik-jan: mode=0700 gid=default Oct 3 22:29:02 drieka dovecot: imap(diederik-jan): Debug: INBOX: Mailbox opened because: SELECT Oct 3 22:29:04 drieka dovecot: imap(diederik-jan): Logged out in=31 out=747
Took me a few tries to get this working though. You need to configure the permissions of /vmail correctly. Are you sure you're looking in the correct log file for finding errors?
You can execute the following to find out:
$ sudo doveadm log find Looking for log files from /var/log Debug: /var/log/syslog Debug: /var/log/mail.log Info: /var/log/syslog Info: /var/log/mail.info Info: /var/log/mail.log Warning: /var/log/mail.warn Warning: /var/log/syslog Warning: /var/log/mail.info Warning: /var/log/mail.log Error: /var/log/mail.warn Error: /var/log/syslog Error: /var/log/mail.info Error: /var/log/mail.err Error: /var/log/mail.log Fatal: /var/log/mail.warn Fatal: /var/log/syslog Fatal: /var/log/mail.info Fatal: /var/log/mail.err Fatal: /var/log/mail.log
Thank you for your reply, Stephan.
But did it create the home directory in the new account's mail folder? e.g. /vmail/domain/user/home?
Because this debug message is exactly similar to what I'm getting: "Debug: Home dir not found: /vmail//diederik-jan/home"
I have thought that there could be a permissions problem, but dovecot is able to create all directories inside the main folder except for that "home" folder. I'm starting to think that maybe sieve is creating that folder on the old server automatically.
My vmail dir (NFS share) is set to 750 (vmail:vmail), but all new maildirs get created with 700.
Here's our log file output:
[root@triata4 ~]# doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot-debug.log Info: /var/log/dovecot-info.log Warning: /var/log/maillog Error: /var/log/maillog Fatal: /var/log/maillog
Asai
On 03/10/2019 22:43, Asai via dovecot wrote:
Tried your config here and it works. My debug log looks as follows for the first brief IMAP session:
Oct 3 22:28:56 drieka dovecot: imap-login: Login: user=<diederik-jan>, method=PLAIN, rip=::1, lip=::1, mpid=21949, secured, session=<OtQjbweUvpIAAAAAAAAAAAAAAAAAAAAB> Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Added userdb setting: plugin/=yes Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Effective uid=1001, gid=1001, home=/vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Home dir not found: /vmail//diederik-jan/home Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace inbox: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/vmail//diederik-jan Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: maildir++: root=/vmail//diederik-jan, index=, indexpvt=, control=, inbox=/vmail//diederik-jan, alt= Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : /vmail//diederik-jan doesn't exist yet, using default permissions Oct 3 22:28:56 drieka dovecot: imap(diederik-jan): Debug: Namespace : Using permissions from /vmail//diederik-jan: mode=0700 gid=default Oct 3 22:29:02 drieka dovecot: imap(diederik-jan): Debug: INBOX: Mailbox opened because: SELECT Oct 3 22:29:04 drieka dovecot: imap(diederik-jan): Logged out in=31 out=747
Took me a few tries to get this working though. You need to configure the permissions of /vmail correctly. Are you sure you're looking in the correct log file for finding errors?
You can execute the following to find out:
$ sudo doveadm log find Looking for log files from /var/log Debug: /var/log/syslog Debug: /var/log/mail.log Info: /var/log/syslog Info: /var/log/mail.info Info: /var/log/mail.log Warning: /var/log/mail.warn Warning: /var/log/syslog Warning: /var/log/mail.info Warning: /var/log/mail.log Error: /var/log/mail.warn Error: /var/log/syslog Error: /var/log/mail.info Error: /var/log/mail.err Error: /var/log/mail.log Fatal: /var/log/mail.warn Fatal: /var/log/syslog Fatal: /var/log/mail.info Fatal: /var/log/mail.err Fatal: /var/log/mail.log
Thank you for your reply, Stephan.
But did it create the home directory in the new account's mail folder? e.g. /vmail/domain/user/home?
Because this debug message is exactly similar to what I'm getting: "Debug: Home dir not found: /vmail//diederik-jan/home"
Ah! I see what you mean now. No, indeed, that home directory is not created. IMAP doesn't really need it, so it doesn't fail. In contrast, ManageSieve does fail on that:
Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: Effective uid=1001, gid=1001, home=/vmail/example.com/pieter-joost/home Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: Home dir not found: /vmail/example.com/pieter-joost/home Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: Namespace inbox: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/vmail/example.com/pieter-joost Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: maildir++: root=/vmail/example.com/pieter-joost, index=, indexpvt=, control=, inbox=/vmail/example.com/pieter-joost, alt= Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: sieve: Pigeonhole version 0.4.25.alpha0 (3bbd9e9c) initializing Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: sieve: include: sieve_global is not set; it is currently not possible to include `:global' scripts. Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: sieve: file storage: Performing auto-detection Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Debug: sieve: file storage: access(/vmail/example.com/pieter-joost/home, rwx) failed: No such file or directory Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Error: sieve: file storage: Could not find storage root directory for write access; path was left unconfigured and autodetection failed Oct 3 22:58:19 drieka dovecot: managesieve(pieter-joost@example.com): Fatal: Failed to open Sieve storage.
Looks like this still old reply from TImo applies: https://dovecot.org/list/dovecot/2013-May/090397.html
The welcome plugin could maybe of help:
https://doc.dovecot.org/plugin-settings/welcome-plugin/
Regards,
Stephan.
Looks like this still old reply from TImo applies: https://dovecot.org/list/dovecot/2013-May/090397.html
The welcome plugin could maybe of help:
https://doc.dovecot.org/plugin-settings/welcome-plugin/
Regards,
Stephan.
Thanks, Stephan, looks like Timo's already answered it.
OK, so the next question is how did I ever get this working in the first place? I don't even remember. I'll look at the welcome plugin.
Thanks!
Asai
One thing Timo mentioned in this post (https://dovecot.org/list/dovecot/2013-May/090397.html) is: "You could also change your new user creation to trigger mkdiring the user's home."
Does anyone know where I can find any documentation on this, or has anyone done this?
Thanks, Asai
On 4 Oct 2019, at 0.47, Asai via dovecot <dovecot@dovecot.org> wrote:
One thing Timo mentioned in this post (https://dovecot.org/list/dovecot/2013-May/090397.html) is: "You could also change your new user creation to trigger mkdiring the user's home."
Does anyone know where I can find any documentation on this, or has anyone done this?
It depends heavily on how do you add users to your system. If you are using LDAP to store the user information then you can create the home directory at the same time you add the user to ldap.
Sami
On 10/4/2019 12:58 AM, Sami Ketola via dovecot wrote:
It depends heavily on how do you add users to your system. If you are using LDAP to store the user information then you can create the home directory at the same time you add the user to ldap.
Sami
Hello, Sami.
Thanks for your reply.
We're just using a SQL backend to store user info. How does this get done with LDAP? Perhaps we can do the same with a SQL backend.
Asai
On 04/10/2019 21:34 Asai via dovecot <dovecot@dovecot.org> wrote:
On 10/4/2019 12:58 AM, Sami Ketola via dovecot wrote:
It depends heavily on how do you add users to your system. If you are using LDAP to store the user information then you can create the home directory at the same time you add the user to ldap.
Sami
Hello, Sami.
Thanks for your reply.
We're just using a SQL backend to store user info. How does this get done with LDAP? Perhaps we can do the same with a SQL backend.
Asai
As experiment, you could maybe use mail_lua plugin to create the user directory on demand,
make a lua script with
function mail_user_created(user) -- create directory for user:home end
See https://doc.dovecot.org/plugin-settings/mail-lua-plugin/ and https://wiki.dovecot.org/Design/Lua
Aki
As experiment, you could maybe use mail_lua plugin to create the user directory on demand,
make a lua script with
function mail_user_created(user) -- create directory for user:home end
See https://doc.dovecot.org/plugin-settings/mail-lua-plugin/ and https://wiki.dovecot.org/Design/Lua
Aki
Thanks, Aki.
I've tried it out and it looks promising. The only issue is debugging, and the documentation isn't entirely clear to me. I need to figure out how to output some debug data to some kind console or file.
Asai
On 10/4/2019 10:31 PM, Aki Tuomi via dovecot wrote:
As experiment, you could maybe use mail_lua plugin to create the user directory on demand, make a lua script with function mail_user_created(user) -- create directory for user:home end See https://doc.dovecot.org/plugin-settings/mail-lua-plugin/ and https://wiki.dovecot.org/Design/Lua Aki
Success.
Using the mail_lua plugin, and configuring the lua script location in the dovecot configs I used this script to create the home folder under the user's mail directory. Hopefully this will help somebody else.
require 'lfs'
function mail_user_created(user) path = "/vmail" domain = user:var_expand("%d") username = user:var_expand("%n")
lfs.mkdir(path .. domain ) lfs.mkdir(path .. "/" .. domain .. "/" .. username ) lfs.mkdir(path .. "/" .. domain .. "/" .. username .. "/home") lfs.mkdir(path .. "/" .. domain .. "/" .. username .. "/home/sieve")
--file = io.open("/etc/dovecot/lualog.log", "w") --file:write(path .. "/" .. domain .. "/" .. username .. "/home/sieve", "\n")
end
participants (5)
-
Aki Tuomi
-
Asai
-
Benny Pedersen
-
Sami Ketola
-
Stephan Bosch