I’ve seen many comments here in Ask Ubuntu regarding preference in using sudo -s
rather than sudo su
.
For me, that two commands do exactly the same. But why is sudo -s
supposed to be better?
I’ve seen many comments here in Ask Ubuntu regarding preference in using sudo -s
rather than sudo su
.
For me, that two commands do exactly the same. But why is sudo -s
supposed to be better?
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,...).