How to Send Emails Using the Sendmail Wrapper

How to set correct permissions for the sendmail wrapper

Issue cause

Cannot send e-mails from scripts or console-based MUAs, using the sendmail wrapper shipped with AXIGEN.

Solution

In order to get sendmail work, first of all, you need to create a symbolic link (if not already created at installation), in the /usr/sbin/ directory, which will link to the ${SENDMAIL} command line wrapper:
 ln -sf ${SENDMAIL} /usr/sbin/sendmail 
After this, change the binary ownership to belong to the 'axigen' user and group and then set its SUID and GUID bits:
chown axigen:axigen ${SENDMAIL}
chmod 6750 ${SENDMAIL}
Note: The chown command will reset the SUID and GUID bits, so you need to issue it before the chmod command.

At the end, in order for any user to be able to send e-mails using the command line sendmail wrapper, you need to insert the respective user in the axigen group.

Warning: Setting the SUID and GUID bits is considered a security issue and should be taken care of very carefully.

Note: Replace ${SENDMAIL} with your OS-specific location of the AXIGEN shipped sendmail binary:
- In Linux/Solaris: /opt/axigen/bin/sendmail
- In FreeBSD/OpenBSD: /usr/local/bin/sendmail.axigen
- In NetBSD: /usr/pkg/bin/sendmail.axigen

Example::
 # If you are using Linux: ln -sf /opt/axigen/bin/sendmail /usr/sbin/sendmail
chown axigen:axigen /opt/axigen/bin/sendmail
chmod 6750 /opt/axigen/bin/sendmail # If you are using FreeBSD: ln -sf /usr/local/bin/sendmail.axigen /usr/sbin/sendmail chown axigen:axigen /usr/local/bin/sendmail.axigen
chmod 6750 /usr/local/bin/sendmail.axigen
OS: LinuxWindowsFreeBSDMACOpenBSDNetBSDSolaris
Distros: Windows