I use these sql-queries to let all mailboxes be accessed by the uid=1001:
passdb sql {
default_password_scheme = MD5-CRYPT
passdb_sql_query = SELECT username as user, password, \
'/home/vmail/%{user | domain }/%{user}' as userdb_home,
'maildir:/home/vmail/%{user | domain }/%{user}' as userdb_mail,
1001 as userdb_uid, 1001 as userdb_gid FROM mailbox WHERE username =
'%{user}' AND active = '1'
}
userdb prefetch { }
( I assume this following query isn't used then anymore)
userdb sql {
userdb_sql_query = SELECT username as user, password,
'/home/vmail/%{user | domain }/%{user}' as userdb_home,
'maildir:/home/vmail/%{user | domain }/%{user}' as userdb_mail,
1001 as userdb_uid, 1001 as userdb_gid
FROM mailbox WHERE username = '%{user}' AND active = '1'
userdb_sql_iterate_query = SELECT userid AS username, domain FROM users
}
id 1001 uid=1001(vmail) gid=1001(vmail) groups=1001(vmail),118(dovecot)
I get errors like:
Apr 01 11:43:05 imap(logs@xunil.at)<1564491><N8oZ6WJO/uwgAQRwHwsMRX9ul+gRMpfY>: Error: open(/home/vmail/xunil.at/logs@xunil.at/dovecot.list.index.log) failed: Permission denied (euid=1001(vmail) egid=1001(vmail) missing +r perm: /home/vmail/xunil.at/logs@xunil.at/dovecot.list.index.log)
ls -l /home/vmail/xunil.at/logs@xunil.at/ total 944 drwx------ 2 vmail vmail 622592 Apr 1 11:43 cur -rw------- 1 vmail vmail 0 Jul 30 2021 dovecot-acl-list -rw------- 1 vmail vmail 3304 Apr 1 11:35 dovecot.index -rw------- 1 vmail vmail 202444 Apr 1 11:43 dovecot.index.cache -rw------- 1 vmail vmail 2908 Apr 1 11:43 dovecot.index.log -rw------- 1 vmail vmail 32892 Apr 1 11:35 dovecot.index.log.2 -rw------- 1 vmail vmail 91 Feb 9 2024 dovecot-keywords -rw------- 1 root root 5744 Apr 1 10:30 dovecot.list.index -rw------- 1 root root 480 Apr 1 10:52 dovecot.list.index.log
[..]
Why do these 2 files get owned by root now ... ?
All files below "/home/vmail" should be owned by vmail:vmail
I ran chown, and chgrp, sure .. but the errors return.
How to fix this? Thanks in advance!