No /sbin PATH after sudo in Fedora 12 even after the PATH is added in .bash_profile
Ed Greshko
Ed.Greshko at greshko.com
Fri Feb 5 07:09:36 UTC 2010
Ed Greshko wrote:
> Sam Sharpe wrote:
>
>>
>> What about this then?
>>
>> [sam at samlap ~]$ echo $PATH
>> /usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/real/RealPlayer:/home/sam/.bin:/opt/real/RealPlayer:/home/sam/.bin
>>
>> [sam at samlap ~]$ sudo sh -c 'echo $PATH'
>> /usr/bin:/bin
>>
>> [sam at samlap ~]$ which lvdisplay
>> /sbin/lvdisplay
>>
>> [sam at samlap ~]$ sudo lvdisplay
>> --- Logical volume ---
>> LV Name /dev/VolGroup00/LogVol00
>> VG Name VolGroup00
>> LV UUID BPwrBK-v6IM-7mkX-pywX-amSI-nACz-xizvzL
>> LV Write Access read/write
>> LV Status available
>> # open 1
>> LV Size 109.62 GB
>> Current LE 3508
>> Segments 1
>> Allocation inherit
>> Read ahead sectors auto
>> - currently set to 256
>> Block device 253:0
>>
>> --- Logical volume ---
>> LV Name /dev/VolGroup00/LogVol01
>> VG Name VolGroup00
>> LV UUID F0Nil4-F0Nf-fDX1-5YxX-QEyc-jPGf-kOiRcy
>> LV Write Access read/write
>> LV Status available
>> # open 1
>> LV Size 1.94 GB
>> Current LE 62
>> Segments 1
>> Allocation inherit
>> Read ahead sectors auto
>> - currently set to 256
>> Block device 253:1
>>
>> How can I run lvdisplay via Sudo, if it has a hard-coded path which
>> doesn't include /sbin? (but it is in *my* PATH). Am I being an idiot?
>>
>>
>>
> Try running....
>
> sudo sh -c 'lvdisplay'
>
>
>
I was more brief than I should have been...and maybe a bit inaccurate.
I should have said....
Try running
sudo sh -c 'lvdisplay'
and think about it a moment and look at the following.....
[gnomer at f12 ~]$ echo $PATH
/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:
/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/gnomer/bin
[gnomer at f12 ~]$ which ifconfig
/usr/bin/which: no ifconfig in
(/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:
/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/gnomer/bin)
[gnomer at f12 ~]$ sudo echo $PATH
/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:
/usr/sbin:/home/gnomer/bin
[gnomer at f12 ~]$ sudo sh -c 'echo $PATH'
/sbin:/bin:/usr/sbin:/usr/bin
[gnomer at f12 ~]$ sudo ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:64 errors:0 dropped:0 overruns:0 frame:0
TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5808 (5.6 KiB) TX bytes:5808 (5.6 KiB)
but....
A script is in /home/gnomer/bin called xmee which executes another
program called iko. iko is located in /usr/local/bin.
[gnomer at f12 ~]$ cat bin/xmee
iko
[gnomer at f12 ~]$ cat /usr/local/bin/iko
echo "I'm in usr local bin"
[gnomer at f12 ~]$ xmee
I'm in usr local bin
[gnomer at f12 ~]$ sudo xmee
sudo: xmee: command not found
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20100205/10fd935d/attachment.bin
More information about the users
mailing list