From owner-freebsd-questions@FreeBSD.ORG Fri Oct 31 19:00:18 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 32B671065670 for ; Fri, 31 Oct 2008 19:00:18 +0000 (UTC) (envelope-from frederic.perrin@resel.fr) Received: from maisel-gw.enst-bretagne.fr (maisel-gw.enst-bretagne.fr [192.44.76.8]) by mx1.freebsd.org (Postfix) with ESMTP id E14648FC0C for ; Fri, 31 Oct 2008 19:00:17 +0000 (UTC) (envelope-from frederic.perrin@resel.fr) Received: from localhost (localhost [127.0.0.1]) by maisel-gw.enst-bretagne.fr (Postfix) with ESMTP id B72AB19D22 for ; Fri, 31 Oct 2008 19:33:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at resel.fr Received: from maisel-gw.enst-bretagne.fr ([127.0.0.1]) by localhost (mercure.adm.maisel.enst-bretagne.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6fyeqLqE-Nua for ; Fri, 31 Oct 2008 19:33:50 +0100 (CET) Received: from chameau.maisel.enst-bretagne.fr (chameau.maisel.enst-bretagne.fr [172.22.209.241]) (Authenticated sender: fperrin) by maisel-gw.enst-bretagne.fr (Postfix) with ESMTP id 09D4319CFD for ; Fri, 31 Oct 2008 19:33:49 +0100 (CET) Received: by chameau.maisel.enst-bretagne.fr (Postfix, from userid 1001) id 144DEB826; Fri, 31 Oct 2008 19:33:45 +0100 (CET) From: =?utf-8?Q?Fr=C3=A9d=C3=A9ric_Perrin?= To: freebsd-questions@freebsd.org Organization: =?utf-8?Q?R=C3=A9seau?= des =?utf-8?B?w4lsw6h2ZXM=?= Date: Fri, 31 Oct 2008 19:33:44 +0100 Message-ID: <86mygklilz.fsf@chameau.maisel.enst-bretagne.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Behaviour of su(1) 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, 31 Oct 2008 19:00:18 -0000 Hello, When I =C2=AB=C2=A0su -=C2=A0=C2=BB to root (after being logged in as my no= rmal user), the LOGNAME env variable is still set to my previous user, as in : ,---- | fred@chameau:~% /usr/bin/su -l | Password: | root@chameau:~# echo $USER - $LOGNAME | root - fred `---- As far as I can tell, this contradicts the fine manual that says : ,---- | -l Simulate a full login. The environment is discarded except for | HOME, SHELL, PATH, TERM, and USER. `---- So I would have expected LOGNAME to be either empty or set by some shell startup script to be root. So, why is LOGNAME still equal to my previous user ? (and where is it set ? =C2=AB grep -r LOGNAME /etc =C2=BB doesn't tu= rn up anything...) This is an issue because emacs, for instance, uses $LOGNAME to load the init-file. I could always add =C2=AB export LOGNAME=3Droot =C2=BB to my she= ll startup file, but this doesn't quite feel right... GNU su (as it is ocnfigured in Debian at least) resets LOGNAME to root in the same situation. (and by the way, GNU su seems broken : if I =C2=AB= =C2=A0gsu -l root=C2=A0=C2=BB, I always get a 'Password incorrect' answer). As a side question, is it considered bad practice to set root's shell and locales to something else then the default ? --=20 Fred