1

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!

2 Answers 2

0

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?

5
  • When I try running as postfix, I get the error "Sorry, user myuser is not allowed to execute "/home/myuser/mailer.rb" as postfix. I am running Red Hat Enterprise Linux Server release 5.4 (Tikanga) Aug 12, 2010 at 19:42
  • Are you sure it's not "sorry user postfix is not allowed to execute"? Try doing sudo -u postfix ls -la /home/myuser/mailer.rb to see if it can even find it. If not: setfacl -m user:postfix:r-x /home/myuser If it can, but just can't execute it, try: setfacl -m user:postfix:r-x /home/myuser/mailer.rb
    – James L
    Aug 12, 2010 at 19:49
  • Yeah, even I noticed that error message and am confused. It is "myuser not allowed to execute as postfix". I can't do anything as sudo -u postfix. It asks for password and when I enter the myuser password, it gives me the same not allowed to execute message. Aug 12, 2010 at 20:03
  • Sorry this is my oversight, the sudo command I gave you needs to be run as root.
    – James L
    Aug 12, 2010 at 20:38
  • So, I found out that it was running as user "nobody". So, I executed setfacl on user "nobody" and it works now! Thanks for the help! Aug 12, 2010 at 21:24
0

Is SELinux enabled? You can check that with getenforce. If it returns enforcing, then SELinux is on and can cause that kind of problems. If you don't need SELinux, you may temporarily disable it with setenforce 0 and see if it cures the problem.

If it does, you may permanently disable SELinux by modifying file /etc/selinux/config.

1
  • Looks like it is disabled $ /usr/sbin/getenforce Disabled Aug 12, 2010 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .