Re: Why use "su -" rather than "su"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2005-07-15 at 16:26 -0400, Peter Arremann wrote:
> On Friday 15 July 2005 12:06, Mike McCarty wrote:
> > Hmm. So I give up my regular editor in return for not having to type /sbin/
> >
> > Well, I think I'll go along the way I am. I'm a pretty good typist.
> >
> > I thought there might be a *real* reason, and I had missed something. I
> > was wondering if there might be some subtle problems which would bite
> > me later.
> 
> The main reason for most unix admins to use 'su -' is that it sets the 
> environment... Some people put nasty things like "." into their path or do 
> other things that might break stuff - LD_LIBRARY_PATH, ... there is tons of 
> things that you usually don't want in the environment of the root user. Hence 
> you use the dash and get rid of all of that... A long long time ago I 
> actually remember discussions of switching the behavior of su to default to 
> "su -" and having an additional switch for it to _not_ give you a login shell 
> - all that simply because su without the dash can be such a nightmare... 

exactly.   with the - you pick up the entire environment the system sets
up for root.  this is not just for picking up specific variables, but
for getting rid of stupid settings and being sure that root has an
absolutely stable environment in place when it does something.  key
element in having a reliable system.

but, remember that su does NOT mean superuser.  it only DEFAULTS to root
if you don't give a user name.

you can su to any user.  think of it as substitute user, not as
superuser.

and in any case, no matter if it is to root or another user, the -
guarantees you've picked up that user's entire environment.  again, it's
the key to having consistent behavior when you are being that user, root
or otherwise.

john


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux