Command: sudo su -
I understand what su - does
- logs you into root with the root environment
- (as opposed to
suwhich logs you into root with your environment)
And I understand what sudo does
- you are root for one command
But I am unsure what this does: sudo su -
Anyone care to clarify
13 Answers
In addition to what you said, su requires the root password and sudo requires your user password
Therefore sudo su - will put you into a root environment but it will ask you for your user password instead of the root password (once sudo has given you root privileges, su - can be executed with no password).
If you are allowed (configuration of sudo) to use the su command, it asks you for your password and then logs you in as root.
Short answer: you will get a root shell.
Long answer: it is different from doing 'su -' within a root shell. Once you exit (eg., Ctrl-D) from 'sudo su -', the execution of sudo will end.
Observed on Debian Wheezy with htop:
'sudo su -' has a child of 'su -', and 'su -' has a child of '-su'.
As mentioned above, root user can do 'su -' without entering password, so doing 'su -' inside of a root shell, you will have two different root shell processes. ending the inner one will let you return back to the outer one.