zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Erik Johnson <palehose@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: LOGNAME not properly set on FreeBSD
Date: Tue, 1 Apr 2014 20:27:46 -0400	[thread overview]
Message-ID: <20140402002746.GA25309@redoubt.spodhuis.org> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2014-04-02  0:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 21:22 Erik Johnson
2014-04-01 21:30 ` Erik Johnson
2014-04-02  0:27 ` Phil Pennock [this message]
2014-04-02  0:50   ` Erik Johnson
2014-04-02 20:54     ` Phil Pennock
2014-04-02 21:11       ` Erik Johnson
2014-04-02  9:23 ` Peter Stephenson
2014-04-02 19:06   ` Erik Johnson
2014-04-02 20:58     ` Peter Stephenson
2014-04-02 21:14       ` Erik Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140402002746.GA25309@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=palehose@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).