What's the difference between su - & su ?
What is the difference with the su - option to root rather than the plain old su option?
|
'su -' reads in the root environment (/root/.bash_profile, etc.) as if you'd logged in as root. This is commonly needed to have /usr/sbin and /sbin included in your PATH. 'su' does not do this, and only elevates your privileges.
|
Quote:
|
No problem. While it IS a matter, of preference, I always use su -. In fact, when I really need to be root, I have an alias that does 'sudo su -'.
Code:
alias rootme='sudo su -' |
Why "sudo su -" instead of "su -"? Just curious...
I used to use "su -" instead of "su", but when I'm su'ing in the first place it's usually because I need to do something with root permissions in the current directory, and it scares me that "su -" takes you away from that directory to /root. It seems to easy to wipe out root's home with a stray rm command, or worse something else if that rm command had a ".." in it. |
Well, 'su -' gives you (as I said) the environment of root... it makes it a login shell. I use sudo so I don't have to type my (very long) root password all the time. It caches and uses my own password (or you could have it not require any password). It really seems to me to just be a matter of personal preference.
|
I see. Just don't forget that very long root password :)
|
Haven't forgotten it yet... knock on wood. Now, the passwords to all my email accounts.... that's a different matter.
|
All times are GMT -5. The time now is 09:32 PM. |