Re: No /sbin PATH after sudo in Fedora 12 even after the PATH is added in .bash_profile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ed Greshko wrote:
> Sam Sharpe wrote:
>   
>>
>> What about this then?
>>
>> [sam@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@samlap ~]$ sudo sh -c 'echo $PATH'
>> /usr/bin:/bin
>>
>> [sam@samlap ~]$ which lvdisplay
>> /sbin/lvdisplay
>>
>> [sam@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@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@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@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@f12 ~]$ sudo sh -c 'echo $PATH'
/sbin:/bin:/usr/sbin:/usr/bin

[gnomer@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@f12 ~]$ cat bin/xmee
iko

[gnomer@f12 ~]$ cat /usr/local/bin/iko
echo "I'm in usr local bin"

[gnomer@f12 ~]$ xmee
I'm in usr local bin

[gnomer@f12 ~]$ sudo xmee
sudo: xmee: command not found



Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux