Sunday, April 28, 2024
26
rated 0 times [  26] [ 0]  / answers: 1 / hits: 17918  / 2 Years ago, sat, august 27, 2022, 7:29:33

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?


More From » command-line

 Answers
0

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,...).


[#43224] Sunday, August 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
theurn

Total Points: 30
Total Questions: 110
Total Answers: 111

Location: Bahrain
Member since Fri, Sep 16, 2022
2 Years ago
theurn questions
Tue, Apr 5, 22, 14:18, 2 Years ago
Mon, Feb 14, 22, 16:29, 2 Years ago
Sat, Apr 8, 23, 05:26, 1 Year ago
Tue, Jan 10, 23, 23:59, 1 Year ago
Fri, Apr 8, 22, 01:36, 2 Years ago
;