Gentoo Archives: gentoo-user

From: Nicolas Richard <theonewiththeevillook@×××××.fr>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Where does sudo get the PATH ?
Date: Mon, 08 Oct 2012 14:21:52
Message-Id: 878vbh82qs.fsf@yahoo.fr
Hi everybody,

I don't understand where sudo finds the value for the PATH env variable.

Here is the output of the relevant (at least I thought they were)
commands. Can somebody explain to me why I still  have
/usr/local/texlive/*2011*/bin/i386-linux in the first sudo output ? I
don't get it, and did not find anything in the man page of sudo.

Thanks in advance for your help.

youngfrog@geodiff-mac3 ~ $ bash -c 'echo $PATH'
~/bin/overrideglobal:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.5.4:/usr/games/bin:/usr/local/texlive/2012/bin/i386-linux:~/bin

youngfrog@geodiff-mac3 ~ $ source /etc/profile

youngfrog@geodiff-mac3 ~ $ bash -c 'echo $PATH'
/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.5.4:/usr/games/bin:/usr/local/texlive/2012/bin/i386-linux

youngfrog@geodiff-mac3 ~ $ sudo bash -c 'echo $PATH'
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/local/texlive/2011/bin/i386-linux

youngfrog@geodiff-mac3 ~ $ sudo -i bash -c 'echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.5.4:/usr/local/texlive/2012/bin/i386-linux:/root/bin

youngfrog@geodiff-mac3 ~ $ sudo grep -r texlive/2011 /etc

youngfrog@geodiff-mac3 ~ $ sudo grep -r texlive/2011 ~root
/root/.bash_history:cd /usr/local/texlive/2011
/root/.bash_history:grep texlive/2011 * -r
/root/.bash_history:grep texlive/2011 . -r
/root/.bash_history:grep texlive/2011 .* -r

youngfrog@geodiff-mac3 ~ $ grep -v '^#\|^$' /etc/environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.5.3:/usr/local/texlive/2012/bin/i386-linux:/root/bin

-- 
N.R.

Replies

Subject Author
Re: [gentoo-user] Where does sudo get the PATH ? "J. Roeleveld" <joost@××××××××.org>
[gentoo-user] Re: Where does sudo get the PATH ? Nicolas Richard <theonewiththeevillook@×××××.fr>