<div dir="ltr"><div class="gmail_default" style="font-size:x-small">To be more clear about my problem. </div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">This server will be hosting multiple email domains, and I would prefer to have the filesystem structured like /var/mail/vmail/<domain>/<user> rather than /var/mail/vmail/<user>@<domain>. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 11, 2021 at 3:06 PM C. Petro <<a href="mailto:petro@cpetro.us" target="_blank">petro@cpetro.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:x-small">I'm trying to build a mail server for a friend using Postfix, Dovecot and Postfixadmin, using Mariadb as the backend for user information and authentication. </div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">I've got it *almost* working. </div><div class="gmail_default" style="font-size:x-small">(dovecot -n at the bottom because I don't think the problem is in the SQL)</div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">I have things up to the point where mail comes in, and where you can get Thunderbird to connect to Dovecot, but delivery is looking at a different directory than IMAP: </div><div class="gmail_default" style="font-size:x-small">root@mailserver:/var/mail/vmail# find ./<br>./<br>./<a href="mailto:petro@republicofmean.com" target="_blank">petro@republicofmean.com</a><br>./<a href="http://petro@republicofmean.com/dovecot.index.log" target="_blank">petro@republicofmean.com/dovecot.index.log</a><br>./<a href="http://petro@republicofmean.com/dovecot-uidvalidity.6136d995" target="_blank">petro@republicofmean.com/dovecot-uidvalidity.6136d995</a><br>./<a href="http://petro@republicofmean.com/tmp" target="_blank">petro@republicofmean.com/tmp</a><br><...><br>./<a href="http://petro@republicofmean.com/new" target="_blank">petro@republicofmean.com/new</a><br>./<a href="http://petro@republicofmean.com/subscriptions" target="_blank">petro@republicofmean.com/subscriptions</a><br>./<a href="http://republicofmean.com" target="_blank">republicofmean.com</a><br>./<a href="http://republicofmean.com/petro" target="_blank">republicofmean.com/petro</a><br>./<a href="http://republicofmean.com/petro/tmp" target="_blank">republicofmean.com/petro/tmp</a><br>./<a href="http://republicofmean.com/petro/cur" target="_blank">republicofmean.com/petro/cur</a><br>./<a href="http://republicofmean.com/petro/new" target="_blank">republicofmean.com/petro/new</a><br>./<a href="http://republicofmean.com/petro/new/1630897562.Vfd00Ib40009M307139.mailserver" target="_blank">republicofmean.com/petro/new/1630897562.Vfd00Ib40009M307139.mailserver</a><br><....></div><div class="gmail_default" style="font-size:x-small">./<a href="http://republicofmean.com/petro/new/1630899062.Vfd00Ib40011M264001.mailserver" target="_blank">republicofmean.com/petro/new/1630899062.Vfd00Ib40011M264001.mailserver</a><br>./<a href="http://republicofmean.com/cer" target="_blank">republicofmean.com/cer</a><br>./<a href="http://republicofmean.com/cer/tmp" target="_blank">republicofmean.com/cer/tmp</a><br>./<a href="http://republicofmean.com/cer/cur" target="_blank">republicofmean.com/cer/cur</a><br>./<a href="http://republicofmean.com/cer/new" target="_blank">republicofmean.com/cer/new</a><br>./<a href="http://republicofmean.com/cer/new/1630900562.Vfd00Ib40013M218855.mailserver" target="_blank">republicofmean.com/cer/new/1630900562.Vfd00Ib40013M218855.mailserver</a><br></div><div class="gmail_default" style="font-size:x-small">./<a href="http://republicofmean.com/cer/new/1630899062.Vfd00Ib40010M259724.mailserver" target="_blank">republicofmean.com/cer/new/1630899062.Vfd00Ib40010M259724.mailserver</a><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">The SQL I think Dovecot is using: </div><div class="gmail_default" style="font-size:x-small">root@mailserver:/etc/dovecot# grep -i select dovecot-sql.conf.ext | grep -v "^#"<br>password_query = SELECT username as user, domain, password FROM mailbox WHERE username = '%u'<br>user_query = select CONCAT("/var/mail/vmail/",maildir) as home, 500 as uid, 500 as gid from mailbox where username="%u"<br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">Here's what Postfix is using: </div><div class="gmail_default" style="font-size:x-small"><a href="http://mysql_virtual_alias_domain_catchall_maps.cf" target="_blank">mysql_virtual_alias_domain_catchall_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_domain_mailbox_maps.cf" target="_blank">mysql_virtual_alias_domain_mailbox_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT maildir FROM mailbox,alias_domain WHERE alias_domain.alias_domain = '%d' and mailbox.username = CONCAT('%u', '@', alias_domain.target_domain) AND mailbox.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_domain_maps.cf" target="_blank">mysql_virtual_alias_domain_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('%u', '@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_maps.cf" target="_blank">mysql_virtual_alias_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT goto FROM alias WHERE address='%s' AND active = '1'<br><a href="http://mysql_virtual_domains_maps.cf" target="_blank">mysql_virtual_domains_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT domain FROM domain WHERE domain='%s' AND active = '1'<br><a href="http://mysql_virtual_mailbox_limit_maps.cf" target="_blank">mysql_virtual_mailbox_limit_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1'<br><a href="http://mysql_virtual_mailbox_maps.cf" target="_blank">mysql_virtual_mailbox_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small"> query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'<br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"># dovecot -n<br># 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf<br># Pigeonhole version 0.5.7.2 ()<br># OS: Linux 5.4.0-81-generic x86_64 Ubuntu 20.04.3 LTS ext4<br># Hostname: <redacted><br>auth_mechanisms = plain login<br>log_path = /var/log/dovecot.log<br>login_greeting = Not your mail server<br>mail_location = maildir:/var/mail/vmail/%u/<br>mail_max_userip_connections = 50<br>mail_privileged_group = vmail<br>namespace inbox {<br> inbox = yes<br> location =<br> mailbox Drafts {<br> special_use = \Drafts<br> }<br> mailbox Junk {<br> special_use = \Junk<br> }<br> mailbox Sent {<br> special_use = \Sent<br> }<br> mailbox "Sent Messages" {<br> special_use = \Sent<br> }<br> mailbox Trash {<br> special_use = \Trash<br> }<br> prefix =<br>}<br>passdb {<br> args = /etc/dovecot/dovecot-sql.conf.ext<br> driver = sql<br>}<br>protocols = " imap lmtp pop3 submission"<br>service auth-worker {<br> user = vmail<br>}<br>service auth {<br> unix_listener /var/spool/postfix/private/auth {<br> group = postfix<br> mode = 0600<br> user = postfix<br> }<br> unix_listener auth-userdb {<br> mode = 0600<br> user = vmail<br> }<br> user = dovecot<br>}<br>service imap-login {<br> inet_listener imap {<br> port = 143<br> }<br> inet_listener imaps {<br> port = 993<br> ssl = yes<br> }<br>}<br>service lmtp {<br> unix_listener lmtp {<br> group = postfix<br> mode = 0600<br> user = postfix<br> }<br>}<br>service pop3-login {<br> inet_listener pop3 {<br> port = 110<br> }<br> inet_listener pop3s {<br> port = 995<br> ssl = yes<br> }<br>}<br>ssl_cert = </etc/letsencrypt/live/<redacted>/fullchain.pem<br>ssl_client_ca_dir = /etc/ssl/certs<br>ssl_dh = # hidden, use -P to show it<br>ssl_key = # hidden, use -P to show it<br>userdb {<br> args = /etc/dovecot/dovecot-sql.conf.ext<br> driver = <br></div><div class="gmail_default" style="font-size:x-small"><br></div></div>
</blockquote></div>