On Ubuntu 12.04, when I
sudo -s the $HOME variable is not changed, so if my regular user is
regularuser, the situation goes like this:
$ cd $ pwd /home/regularuser $ sudo -s # cd # pwd /home/regularuser
I have abandoned Ubuntu a long time ago, so I cannot be sure, but I think this is the default behavior. So, my questions are:
Q1. How is this done? Where is the config?
Q2. How do I disable it?
Edit: Thanks for the answers, which clarified things a bit, but I guess I must add a couple of questions, to get the answer I am looking for.
Q3. In Debian
sudo -s, changes the $HOME variable to
/root. From what I get from the answers and
man sudo the shell ran with
sudo -s is the one given in
Q4. However, on both Ubuntu and Debian the shell given in
/etc/passwd for root is
/bin/bash. In either system also, I cannot find where the difference in
.bashrc files is, as far as $HOME is concerned, so that the behavior of
sudo -s differs. Any help on this?