[Dovecot] Accessing mail files not owned by imap login user

Robert Schetterer rs at sys4.de
Fri May 3 18:27:43 EEST 2013


Am 03.05.2013 16:11, schrieb Ben Morrow:
>  have managed to set up a 'maildir' based mail system using fetchmail and
>> procmail that delivers sorted mail to folders /var/spool/mail/user1,
>> ../user2 etc. 'user1', 'user2' etc. are real users but the mail system is
>> run under logged in user 'mailserver'. The mail folders are owned by
>> 'user1', 'user2' etc. but mail files, when delivered, are owned by
>> 'mailserver'. I've been unable to find a way to change this behaviour

why using procmail, fetchmail....,go modern ways

normally its mostly the best to have one extra user vmail group vmail


then use getmail with additional clamdscan and spamc , if you like,
at last "give" to dovecot deliver which uses sieve ,acl, quota

i.e

getmail.rc

[options]
 verbose = 0
 message_log = /var/log/getmail.log
 read_all = false
 delivered_to = false
 delete = false

 [retriever]
 type = SimplePOP3Retriever
 server = mail.beispiel.com
 username = user at beispiel.com
 password = .....

[filter-1]
allow_root_commands = True
type = Filter_classifier
path = /usr/bin/clamdscan
arguments = ("--stdout", "--no-summary", "-")
exitcodes_drop = (1, )

[filter-2]
allow_root_commands = True
type = Filter_external
path = /usr/bin/spamc
arguments = ("-s", " 250000", "-u", "user1 at server.com")

[destination]
type = MDA_external
path = /usr/lib/dovecot/deliver
arguments = ("-d", "user1 at server.com")
user = vmail
group = vmail

minimum in dovocot.conf something like

...
passdb {
driver = passwd-file
args = scheme=plain-md5 username_format=%n /etc/dovecot/imap.passwd
}
userdb {
driver = passwd-file
args = username_format=%n /etc/dovecot/imap.passwd
default_fields = local_port=%a
}
...

imap.passwd

...
user1 at server.com:{plain}pass:vmail:vmail::/usr/local/virtual/user1 at server.com::userdb_mail=maildir:~/Maildir
user2 at server.com:{plain}pass:vmail:vmail::/usr/localvirtual/user2 at server.com::userdb_mail=maildir:~/Maildir
...

...
mkdir /usr/local/virtual/user1 at server.com
mkdir /usr/local/virtual/user1 at server.com/Maildir
..

chown -R vmail:vmail  /usr/local/virtual/*

notice this is not copy paste stuff, some things may different at your
server and distro !!!

some blog ( only german )

http://sys4.de/de/blog/2013/04/12/abholdienst-fur-mail/


Best Regards
MfG Robert Schetterer

-- 
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein


More information about the dovecot mailing list