When I run sudo, what exactly happens to my environment?
When I run sudo command
, it doesn't seem to see my or root's environment. For example, my path for both includes /usr/local/bin
, but if I try to run one of the program's without the full path, it fails.
I thought sudo ran as root, and hence got root`s environment. Is there a different way that bash executes under sudo than under root or my normal user?
EDIT:
I have been using sudo -i
lately, but recently it has been causing problems because my current working directory gets set to /root
. This is as expected (sorta), but I still don't understand why sudo isn't recognizing my executables in /usr/local/bin
.
EDIT:
I am running Fedora 15.
PATH
, and sometimes it's not easy to find who overrides it last. It could be some system setting (e.g. in PAM), sudo itself, or a subsequent profile script.