Skip to main content
6 events
when toggle format what by license comment
Aug 31, 2015 at 17:45 comment added dannysauer [user@host] /home/user$ sh -c 'echo $PATH' /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/quest/bin:/usr/local/sec:/var/cfengine/bin [user@host] /home/user$ sudo -i sh -c 'echo $PATH' /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/quest/bin:/usr/local/sec:/var/cfengine/bin:/var/cfengine/bin:/root/bin
Aug 25, 2015 at 22:25 comment added Chris Davies @Klaatu but sudo -i echo $PATH is evaluating $PATH in the user's context, not root's.
Aug 25, 2015 at 22:03 comment added Klaatu von Schlacker @roaima sudo -i does not inherit the root PATH. Try echo $PATH and then sudo -i echo $PATH, then do sudo -i and once at a root prompt, do echo $PATH.
Aug 25, 2015 at 21:00 comment added Chris Davies Why sudo su and not sudo -i?
Aug 25, 2015 at 20:33 comment added Electric Coffee it's worked just fine on all the systems I've tested it on.. Linux and BSD alike, hence the confusion
Aug 25, 2015 at 20:32 history answered Klaatu von Schlacker CC BY-SA 3.0