From owner-freebsd-questions@FreeBSD.ORG Fri Dec 11 22:56:45 2009 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 A92C91065693 for ; Fri, 11 Dec 2009 22:56:45 +0000 (UTC) (envelope-from hkunst@moneyfitness.com) Received: from mail.truebridge.com (mail.truebridge.com [216.75.192.44]) by mx1.freebsd.org (Postfix) with ESMTP id 449018FC0C for ; Fri, 11 Dec 2009 22:56:44 +0000 (UTC) Received: (qmail 31729 invoked from network); 11 Dec 2009 17:28:42 -0500 Received: from static-71-243-118-33.bos.east.verizon.net (HELO ?192.168.199.40?) (hkunst@71.243.118.33) by mail.truebridge.com with SMTP; 11 Dec 2009 17:28:42 -0500 Message-ID: <4B22C778.5070200@moneyfitness.com> Date: Fri, 11 Dec 2009 17:28:08 -0500 From: Holger Kunst User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0pre Thunderbird/3.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Email sent from "at" command going to the wrong account 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: Fri, 11 Dec 2009 22:56:45 -0000 Hi, The "at" command sends and email with the output of the scheduled job. I've experienced inconsistent results when running jobs, receiving emails in accounts not associated with the user currently logged in. To reproduce in FreeBSD 7.2-RELEASE-p2 Case #1 login as user a (new shell through ssh) echo "echo 1" | at now --> user a will receive an email containing "1" - this is as expected Case #2 login as user a (new shell through ssh) login as user b exit echo "echo 1" | at now --> user b will receive an email containing "1" - this is not as expected, since I am user a again A look at the source for "at" reveals that "at" is getting the mailname from getlogin(). Running a small test program that outputs getlogin(), confirms the above behavior: A log-in and out of another account makes getlogin() return that account's name, even though the shell has been closed and we are back to the original shell and the original user a. Is this the intended behavior? Any hints would be apprecaited. Best regards, Holger Kunst