I'm using exim4 on Debian 8. I'm using maildir. I have an Exim Filter file that tries to store incoming mail in folders named by their domain.
The problem is that when Exim creates a new directory the permissions are 700 but they need to be 770.
The router:
v_user_filters:
driver = redirect
domains = dsearch;/etc/exim4/virtual_domains
local_parts = lsearch;/etc/exim4/virtual_domains/$domain/passwords
user = virtual
group = virtual
check_owner = false
file = /home/virtual/$domain/$local_part/filter.forward
no_verify
no_expn
check_ancestor
allow_filter
forbid_smtp_code = true
directory_transport = address_directory
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
The transport:
address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
directory_mode = 0770
Note the directory_mode
which apparently does this:
If appendfile creates any directories as a result of the create_directory option, their mode is specified by this option.
The filter:
# exim filter
# File by domain.
if ${sg{${sg{$reply_address}{^.*?@}{}}}{>\$}{}} matches "^[a-zA-Z0-9-](\.[a-zA-Z
then
# This horrible regex substitution:
# inner sg: strip off everything from beginning of reply_address to and incl @
# middle sg: strip off trailing > if found
# outer sg: convert dots to - since dots mean sub-folders and we don't want example/com we want example-com
save /home/virtual/$domain/$local_part/.${sg{${sg{${sg{$reply_address}{^.*?@
finish
endif