public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Linda Walsh <lkml@tlinx.org>
Cc: util-linux@vger.kernel.org
Subject: Re: regression bug: user loses DISPLAY & REMOTEHOST with  'su -p - username"
Date: Wed, 18 Dec 2013 11:54:54 +0100	[thread overview]
Message-ID: <20131218105454.GA21748@x2.net.home> (raw)
In-Reply-To: <52B0DA78.8060109@tlinx.org>


 Hi Linda,

On Tue, Dec 17, 2013 at 03:12:56PM -0800, Linda Walsh wrote:
> 
> "su --preserve_environment - username" no longer preserves
> your REMOTEHOST and DISPLAY values.  They should be
> in the same class as 'TERM', as they are passed from the
> pre-login environment.
> 
> I don't know if there are other values that shouldn't be
> removed -- but it is bad to clear the environment just
> because one wants a shell called with '-<shell>'.

Please, when you call a problem "regression" then it would be nice
to know which version was correct... because util-linxu su(1) is code
from coreutils and I see in the original code as well as in the
current code:

 if (simulate_login) {
    ... reset environment ...

 } else if (change_environment) {  
    ... modify HOME, SHELL, ...
 }


it means that --login and --preserve-environment has been always
mutually exclusive and the latest version prints wanning when the
options are use together. It's also described in the man page.

> The preserve environment flag is NOT incompatible with login.
> It means don't clear the env, but do call login via -<shell>.
> 
> -p means don't clear the ENV -- but do call the user's shell
> with a '-' in front of it.  That has always been the functionality
> of 'su'.
>
> If you want to make 'su' fancier, maybe it needs a "/etc/suers.conf"
> file so specific values can be easily changed to reflect
> site policy rather than hard coding them.

It would be probably better to use PAM for such things.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2013-12-18 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 23:12 regression bug: user loses DISPLAY & REMOTEHOST with 'su -p - username" Linda Walsh
2013-12-18 10:54 ` Karel Zak [this message]
2013-12-18 20:05   ` Linda Walsh

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=20131218105454.GA21748@x2.net.home \
    --to=kzak@redhat.com \
    --cc=lkml@tlinx.org \
    --cc=util-linux@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox