From owner-freebsd-questions@FreeBSD.ORG Thu Jan 10 12:14:37 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF26516A46D for ; Thu, 10 Jan 2008 12:14:37 +0000 (UTC) (envelope-from mike@urgle.com) Received: from anchor-post-37.mail.demon.net (anchor-post-37.mail.demon.net [194.217.242.87]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF6C13C44B for ; Thu, 10 Jan 2008 12:14:37 +0000 (UTC) (envelope-from mike@urgle.com) Received: from cheddar.urgle.com ([80.177.40.53]) by anchor-post-37.mail.demon.net with esmtp (Exim 4.68) id 1JCwIm-0002N1-PE; Thu, 10 Jan 2008 12:14:34 +0000 Received: from mike by cheddar.urgle.com with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1JCwIj-0005X1-G7; Thu, 10 Jan 2008 12:14:25 +0000 Date: Thu, 10 Jan 2008 12:14:25 +0000 From: Mike Bristow To: Jim Bow Message-ID: <20080110121425.GA21247@cheddar.urgle.com> References: <47834FB2.9010907@darq.net> <443at70zy1.fsf@be-well.ilk.org> <4785F786.1010706@darq.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4785F786.1010706@darq.net> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-questions@freebsd.org Subject: Re: mail from: field question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 12:14:38 -0000 [ apologies to Jim Bow who gets this twice due to my fingers typing faster than my brain. ] On Thu, Jan 10, 2008 at 10:46:30AM +0000, Jim Bow wrote: > If I run the script (or just send a mail) on the command line using sudo, > then it's sent as me and not root. Same happens if I su to root first. use 'su -'. It means you get a login shell (which sets up the enviroment in the same way that login does). I expect you can do the same thing with sudo with something like 'sudo bash -login' or similar. > The only way I can get it to be sent from root is if I explicitly login as > root. > >> Make sure the results are the same (if they're not, the MTA isn't > > the problem). > > So it looks like it isn't. What can be the cause of this then? The extra things the shell does when running as a login shell; in particular clearing the enviroment and setting things like LOGNAME and USER (which I expect /usr/bin/mail and others pay attention to). -- Shenanigans! Shenanigans! Best of 3! -- Flash