Why use "su -" rather than "su"

Peter Arremann loony at loonybin.org
Fri Jul 15 20:26:05 UTC 2005


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... 

Peter.




More information about the fedora-list mailing list