0

I have a shell script which is looking for a mailbox path

result=`find /var/mailboxes -type d -name me@my-domain.com`
perl -pi -e 's/Folder-to-Remove//g' $result/subscriptions

but executing it via Dovecot Sieve I'm getting an error message:

lmtp: Error: find: `/var/mailboxes/63': Permission denied

where /var/mailboxes/63 is not even owned by me@my-domain.com

Shell script has permission to execute by others.

1

The error means that the Unix user that is used to execute the script, does not have permissions to access /var/mailboxes/63 directory / file.

You need to find out some solution so that the directory / file permissions / ownership is set up so that the Dovecot Sieve user can access it. One has to keep security issues in mind.

In order to give a more complete answer, I need to see the ownership and permissions of the file / directory and the Unix user and the user's group used to run the Sieve script.

  • But /var/mailboxes/63 is not right result for that find command anyway. When I execute that script via bash I'm getting correct path. – JackTheKnife Dec 9 '16 at 15:55
  • 1
    The find command searches through all files in /var/mailboxes, and the error occurs because it cannot access /var/mailboxes/63. – Tero Kilkanen Dec 9 '16 at 15:58
  • OK, got it. Is there any way to tell find to skip that mbox? – JackTheKnife Dec 9 '16 at 16:03
  • find has quite powerful methods for searching, I think there might be an option to exclude directories from search. However, I don't know exactly what the option is. – Tero Kilkanen Dec 9 '16 at 19:19
  • 1
    Use -type d -name what_I_want_to_exclude -prune – Chris Rees Dec 10 '16 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.