su root vs. su - root

Moderator: NorbertKrupa

Post Reply
debfawn
Beginner
Beginner
Posts: 47
Joined: Tue Jan 29, 2013 2:30 pm

su root vs. su - root

Post by debfawn » Fri May 10, 2013 4:24 pm

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.

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: su root vs. su - root

Post by JimKnicely » Fri May 10, 2013 4:58 pm

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!
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

debfawn
Beginner
Beginner
Posts: 47
Joined: Tue Jan 29, 2013 2:30 pm

Re: su root vs. su - root

Post by debfawn » Tue May 14, 2013 7:13 pm

Thank you, Jim! I will start using su with the hyphen.

Post Reply

Return to “Vertica and the Operating System”