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 For me, that two commands do exactly the same. But why is |
||||
|
I think
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
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 So basically it's like |
|||
|
|
|
Aside from the already mentioned differences with environment variables, I find |
|||||||||||
|
|
I would disagree with other answers when considering the cases when you want to log in as a user who do not have a shell. That is a very common case with users assigned to services. Using "sudo su" will start the shell specified by the user. However in the case of a user assigned to server process, the shell is /usr/bin/false and the logging will fail. Instead you should enter as:
that will log you in and cd to its home path, even if the user does not have a shell assigned |
||||
|
|
sudo -iorsudo suis better thansudo -sfor reasons mentioned here: ubuntuforums.org/showpost.php?p=6188826&postcount=4 Also: this is a possible duplicate of superuser.com/questions/29/… – arrange Oct 4 '11 at 6:27