Possible Duplicate:
Why do we use su - and not just su?
I understand that root doesn't have to be a superuser. But in the case that it is ... what is the difference between sudo su - and sudo su root?
Possible Duplicate:
Why do we use su - and not just su?
I understand that root doesn't have to be a superuser. But in the case that it is ... what is the difference between sudo su - and sudo su root?
There are two questions there:
su - username and su usernameIf - (or -l) is specified, su simulates a real login. The environment is cleared except for a few select variables (TERM notably, DISPLAY and XAUTHORITY on some systems). Otherwise the environment is left as it is except for PATH that is reset.
rootThis might be system-dependent. On Linux with shadow as the package providing su, if no username is specified, then su first tries to see if user root has a passwd entry. If it does, it uses that. If it doesn't, it tries uid 0.
Not sure about other Unix-like operating systems.
su - switches to the superuser and sets up the environment so that it looks like they logged in directly. su root switches to the user named root and doesn't simulate directly logging in.
If the superuser is named root, then su and su root are equivalent (and don't simulate directly logging in), as are su - and su - root (which do).
sudo.