LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sendmail: Remove "From: root" label (https://www.linuxquestions.org/questions/linux-software-2/sendmail-remove-from-root-label-476613/)

davidmc57 08-23-2006 11:08 AM

sendmail: Remove "From: root" label
 
Hi,

I am using sendmail (RH 9.0) to send logs from crontab jobs to my regular work address. I managed (after a week of searching this forum) to masquerade the sender address so that the "From:" field shows "david@example.com" instead of the "localhost.localdomain". However, when I receive the message (I use Outlook) I get:

From: root[david@example.com]
To: user@domain.com
Subject: Hello

How can I get rid of this "root" label or at least change it to something else so it appears to come from a human user? The crontab jobs run as "root" and I do not know if I can run them as some other username.

Thanks in advance

gilead 08-24-2006 06:16 AM

IIRC sendmail gets the username from the /etc/passwd file. What's the value for the fifth field in /etc/passwd for your root user? You can try setting this and re-running the cron job - it might help...

unSpawn 08-24-2006 06:31 AM

The crontab jobs run as "root" and I do not know if I can run them as some other username.
Try explicitly setting MAILTO=david@example.com in that cronjob. If it doesn't you also could add some mask rules in sendmail.cf but that's a last resort option and it's likely to fsck things up major:
[code]
# Masquerading rules
S1
Rroot<@localhost> $@ david < @ localhost>
Rroot<@localhost.> $@ david < @ localhost.>

davidmc57 08-31-2006 02:57 PM

Thanks for your feedback! The root user values on the /etc/passwd file was "root" and I changed it to "david":

root:x:0:0:david:/root:/bin/bash.

Now the mail I send from this unit is received on the other end the way I wanted it: FROM: david[david@example.com].

So far this change does not seem to have affected anything else. The whoami command still shows "root" and the system reboots normally with the root login.

Thank you very much for your help!!!!

David

benjithegreat98 08-31-2006 03:57 PM

When in your cronjobs could you do something like this:
Code:

su david -c "command"
That way when the cronjob with root access runs the command it will have the access of david.


All times are GMT -5. The time now is 11:28 PM.