Linux – problem running script on receiving emai

linuxpostfix

I would like to run a script when an email is received. I added this line to /etc/aliases

myuser: "|/home/myuser/mailer.rb"

When I send an email to myuser@domain, I see permission denied error in the maillog.

Aug 12 14:17:59 stag postfix/local[29300]: E5B8F67024F: to=, relay=local, delay=1596, delays=1596/0.01/0/0.02, dsn=4.3.0, status=deferred (temporary failure. Command output: local: fatal: execvp /home/myuser/mailer.rb: Permission denied )

The permission on mailer.rb is 755. Why would I get a permission denied error?

I would appreciate any help. Thanks!

Best Answer

Can you get as far as the script with that user? I'm guessing it can't open the user's home directory. Try
sudo -u postfix /home/myuser/mailer.rb to confirm this. To fix it, which distro are you running?