Why is sudo -s better than sudo su?

I think sudo -s is not "better", it's just different.

sudo -s

keeps your $HOME directory, so when you start programs, they will use your (and not root's) config files etc. Disadvantage: they can also change the ownership of your files in the $HOME directory, typical example is the .Xauthority file, but I have never experienced a problem with that.

sudo su or sudo -i

programs will use the root's home directory and its config files. This might be more intuitive, but it also means that it will not use any configuration you may have set for yourself (aliases, bash history,...).


Because sudo -s will not change your environment variables, especially $HOME, which will stay HOME=/home/USER. If you use sudo su this will change to HOME=/root which can have negative side effects when programs you start try to access your user's home directory.

So basically it's like sudo vs gksudo when running graphical programs.


Aside from the already mentioned differences with environment variables, I find sudo su silly and wasteful because you are asking sudo to run su as root, and ask it to run a shell as root. Why ask a program to ask a program to give you a root shell, when you can just have the first program give you that shell? Does that matter in any practical sense? No, I'm just pedantic.