Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to execute a sendmail alias script using this

# aliases for my system
addressx:        |sh /usr/share/scripts/  WON'T WORK
addressx:        '/usr/share/scripts/'  WON'T WORK
addressx:        '|/usr/share/scripts/'  WON'T WORK

Can I execute scripts or it must be a binary file ?

share|improve this question
up vote 3 down vote accepted

Sendmail uses a restricted shell to execute. You have to put programs that Sendmail can execute in the /etc/smrsh directory. You can find out more about this here.

You should of course also ensure that the execute bit is set appropriately on that script, and that it is world readable (but not world writable).

share|improve this answer
worked perfectly. Shit! never saw such a complicated config file like the thanks – Rodrigo Asensio May 4 '10 at 18:46

The P= equate shows which shell is used to execute piped delivery. This is typically either /usr/bin/smrsh or /bin/sh. You should use whichever one meets your needs. /bin/sh is less persnickety but is less secure. /usr/bin/smrsh is more secure but has rules.

You don't need to do something like |sh, the shell is identified in the sendmail configuration.

You can execute scripts as well as binary files, BTW.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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