2
On a fresh Ubuntu 14.04 install, the bash environment for the root user does not have $HOME
defined. I need to run some apps from a root shell, for example:
gdb /usr/sbin/apache2
This is difficult without a working $HOME
directory, because apps like vim
and gdb
require $HOME
in the environment, and they are somewhat broken without it. Adding
export HOME=/root
to /root/.bashrc
works (though I noticed the apache2
environment script unsets $HOME
).
What is the proper way for HOME=/root
to be defined in the root environment? Is there a reason it wasn't defined in the first place? Should $HOME
not be defined for the root user?
Thanks--though I do have
/root
in the normal place in /etc/password. Does that mean something was issuing aunset HOME
command? It seems like the variable must have been deliberately unset at some point. – Byron Hawkins – 2015-01-30T09:10:35.950Seems so. You could search for
HOME
in config files and rc scripts:grep HOME /etc/*
andgrep HOME ~/.*
. Maybe that will reveal some scripts that unset/resets the variable. – chaos – 2015-01-30T09:29:55.603Looks like it was just the
apache2
environment script, which I must have executed a couple times without realizing it. So nothing is wrong with my user config after all... – Byron Hawkins – 2015-01-30T09:32:00.390