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 |
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...
|
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.> |
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 |
When in your cronjobs could you do something like this:
Code:
su david -c "command" |
All times are GMT -5. The time now is 11:28 PM. |