Run SENDMAIL as it’s own different user

You may need to change Sendmail to run as another user instead of root. In order to do this, run the commands below. We are using sendmail for the user, and sendmail for group. Make sure to stop the sendmail service by using the service sendmail stop command. You may also need to kill any running processes by using the killall sendmail command.

groupadd -g 24 sendmail

useradd -u 24 -g 24 -M -d /var/spool/mqueue \-s /dev/null sendmail

chown -R sendmail:sendmail /var/spool/mqueue

chmod 700 /var/spool/mqueue

chgrp -R sendmail /etc/mail

chmod -R g+r /etc/mail

chmod g+s /etc/mail

 

Now edit the /etc/mail/sendmail.mc file, and add the following directive to it:

define(`confRUN_AS_USER’, `sendmail:sendmail’)dnl

Once these steps are performed, you can restart the sendmail service by using the service sendmail start command.

 

Leave a Reply

Your email address will not be published. Required fields are marked *