Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: LOGNAME not properly set on FreeBSD
- X-seq: zsh-workers 32516
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Erik Johnson <palehose@xxxxxxxxx>
- Subject: Re: LOGNAME not properly set on FreeBSD
- Date: Tue, 1 Apr 2014 20:27:46 -0400
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201312; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=b4TK5+EhHVHJURSjW0P3ifLJPkL3eAmNZIN7qlJY8Ro=; b=g11O3JgZRtclJrrvv3pWsLHmHpHb4Cs2Bd29Q7T1nwTf8BPRzXxcVTaNhJszjBAxKwj3lIAjUNnMBEf37UPgCb1gfUikj1q83Ju3wQo7ssYYUtIklSdFzlR0LFmg+Yz9/t9bat3inUlzvqv4Y9Th8BArh65caqfzWZt6ouG0nbMTtIgoEUqF83okUmypz8nqV5ce6AWPyQr0Ej3+;
- In-reply-to: <20140401212239.GE20508@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Erik Johnson <palehose@xxxxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/0x3903637F.asc
- References: <20140401212239.GE20508@gmail.com>
On 2014-04-01 at 16:22 -0500, Erik Johnson wrote:
> When using "su - username" to change users, zsh is not properly setting
> the LOGNAME environment variable on FreeBSD. Example below.
----------------------------8< cut here >8------------------------------
LOGNAME
If the corresponding variable is not set in the environment of
the shell, it is initialized to the login name corresponding to
the current login session. This parameter is exported by default
but this can be disabled using the typeset builtin.
----------------------------8< cut here >8------------------------------
This is the _login_ name, as a convenience, it's not the _current_ name,
and is not defined as such. The whole point is that if you su to
another account, LOGNAME can persist as the original. It's not
_trustworthy_, but might be used to let you have a .zshrc.staff.$LOGNAME
file which might be auto-sourced, or whatever else you want.
If you do:
% typeset +x LOGNAME
then LOGNAME won't be exported.
> erik@virtubsd:~% su - root
> Password:
> virtubsd# echo $LOGNAME
> erik
Yup, that's exactly what it's supposed to do.
You might want USERNAME instead of LOGNAME ?
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author