This is annoying. I ssh to a server, then, it doesn't matter if I su - or sudo -s, I start a service (motion, if it matters), and when the service sends an email, it's from me, not from root, or the user the service runs as.
I've dumped my environment, I've just dumped service's environment. I've set SUDO_USER to root, and SUDO_UID to 0, and restarted the service, and still no joy.
My manager found this trick: echo "To: user
help " | sendmail -t
and the same thing happens.
Anyone else run into this? No relevant google hits so far.
mark
m.roth@5-cent.us wrote:
This is annoying. I ssh to a server, then, it doesn't matter if I su - or sudo -s, I start a service (motion, if it matters), and when the service sends an email, it's from me, not from root, or the user the service runs as.
I've dumped my environment, I've just dumped service's environment. I've set SUDO_USER to root, and SUDO_UID to 0, and restarted the service, and still no joy.
My manager found this trick: echo "To: user
help " | sendmail -t
and the same thing happens.
Anyone else run into this? No relevant google hits so far.
He got the answer, too, by running sendmail under strace: never mind anything else, sendmail's getting the user from /proc/self/loginuid
Groovy....
mark
On Tue, Dec 20, 2011 at 03:10:31PM -0500, m.roth@5-cent.us wrote:
echo "To: user
help " | sendmail -t
If you're gonna send automated email, you should specify the from address as well echo "To: user From: my_service_alias@example.com Subject: testy mctesty
bleh" | /usr/sbin/sendmail -t
Never leave to chance what should be specified.