Why use "su -" rather than "su"

Aleksandar Milivojevic alex at milivojevic.org
Sat Jul 16 01:07:32 UTC 2005


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.

When using "su -", you get root's environment.  It is inherently safer 
to do tasks in environment that is not poluted with regular user's settings.

If you all you want is your favorite editor that is installed in 
non-standard location, you might consider:

a) make symbolic link to it from /usr/bin, or
b) edit root's initialization file in /root to add editor to the PATH 
variable.

You may also want to edit root's initialization files in /root to set 
EDITOR environment variable to /path/to/your/editor, so that various 
program that need to invoke editor (for example "crontab -e") will 
invoke your editor of choice.

Personally, I'm comfortable with standard vi editor, and once you are 
past its basic usage, you'd get root's tasks done much quicker in it 
than in any other editor (the "dot" command rules ;-)




More information about the fedora-list mailing list