Like title says, is there a difference between these two commands :
sudo su - root
sudo -u root -H /bin/bash
I'm using GNU/Linux, if that makes a difference.
|
|
|
If you want to become root, the best way to do so is sudo -i, which simulates the initial login (giving you all the paths/variables associated with a root login). If you want to login without getting the root users .files, you could just use sudo su (no need to specify the root user). |
|||||
|
and
But in this case, bash is not run as a login shell. |
|||
|
|
|
Obviously, they can differ if root shell isn't /bin/bash - this is possible for tiny or embedded Linux environments, or traditional for BSD systems which prefer /bin/[t]csh for root user. Also, `su -' drops all environment except a few variables related to the terminal. sudo's behavior on environment is configurable (see env_reset in /etc/sudoers). So, be careful with details... |
|||
|
|
|
The biggest difference between the two commands you listed is that running |
|||
|
|