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
1 Hi everybody,
2
3 I don't understand where sudo finds the value for the PATH env variable.
4
5 Here is the output of the relevant (at least I thought they were)
6 commands. Can somebody explain to me why I still have
7 /usr/local/texlive/*2011*/bin/i386-linux in the first sudo output ? I
8 don't get it, and did not find anything in the man page of sudo.
9
10 Thanks in advance for your help.
11
12 youngfrog@geodiff-mac3 ~ $ bash -c 'echo $PATH'
13 ~/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
14
15 youngfrog@geodiff-mac3 ~ $ source /etc/profile
16
17 youngfrog@geodiff-mac3 ~ $ bash -c 'echo $PATH'
18 /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
19
20 youngfrog@geodiff-mac3 ~ $ sudo bash -c 'echo $PATH'
21 /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/local/texlive/2011/bin/i386-linux
22
23 youngfrog@geodiff-mac3 ~ $ sudo -i bash -c 'echo $PATH'
24 /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
25
26 youngfrog@geodiff-mac3 ~ $ sudo grep -r texlive/2011 /etc
27
28 youngfrog@geodiff-mac3 ~ $ sudo grep -r texlive/2011 ~root
29 /root/.bash_history:cd /usr/local/texlive/2011
30 /root/.bash_history:grep texlive/2011 * -r
31 /root/.bash_history:grep texlive/2011 . -r
32 /root/.bash_history:grep texlive/2011 .* -r
33
34 youngfrog@geodiff-mac3 ~ $ grep -v '^#\|^$' /etc/environment
35 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
36
37 --
38 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>