Page 1 of 1

su root vs. su - root

Posted: Fri May 10, 2013 4:24 pm
by debfawn
Hello,

When switching to the root user, what is the difference between using the "su root" command and the "su - root" command? Either way seems to work fine for me. I was just curious which method is best practice.

Thank you.

Re: su root vs. su - root

Posted: Fri May 10, 2013 4:58 pm
by JimKnicely
Hi,

I don't think its a matter of "Best Practice". It depends on what you want to happen!

Both "su - root" and "su root" will start a new shell for you. The difference is that "su - root" will execute root's profile, while "su root" does not...

I hope this helps!

Re: su root vs. su - root

Posted: Tue May 14, 2013 7:13 pm
by debfawn
Thank you, Jim! I will start using su with the hyphen.