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]

 



suvayu ali wrote:
> On 4 February 2010 16:13, Tom Horsley <tom.horsley@xxxxxxx> wrote:
>   
>> On Thu, 4 Feb 2010 16:00:39 -0800
>> suvayu ali wrote:
>>
>>     
>>> As far as I understand this, sudo still uses your (the regular user's)
>>> $PATH.
>>>       
>> Nope, that's merely what the docs claim. In fact, the security geeks
>> decided sudo absolutely needed to have a hard coded PATH and as far
>> as I know the only way to fix that is to rebuild it from source. It
>> has been like this for a while now.
>>     
>
> Are you sure? I tried this after your post on my lab machine (not
> Fedora though, its Ubuntu 9.04)
>
> $ sudo echo $PATH
> [sudo] password for suvayu:
> /home/suvayu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/suvayu/root/bin
>
> I see two different directories that I add to $PATH in my
> .bash_profile and .bashrc
>
>   
>> https://bugzilla.redhat.com/show_bug.cgi?id=475990
>>
>> Maybe you could create an alias that runs sudo env PATH=$PATH "$@"
>> or something to sneak the path back into the sudo'ed command...
>>     
>
> That Bugzilla says updates have been pushed to F10. Shouldn't that
> mean its fixed in F11 and F12?
>
>   
I think you miss one thing....

When you do "sudo echo $PATH"  $PATH is expanded before the sudo command
is executed since it is an argument to the sudo command.

To demonstrate what Tom is saying you need to prevent $PATH from being
expanded by using sudo sh -c 'echo $PATH'

As in...

[egreshko@f12 ~]$ sudo sh -c 'echo $PATH'
/sbin:/bin:/usr/sbin:/usr/bin

-- 
The FALAFEL SANDWICH lands on my HEAD and I become a VEGETARIAN... is a
barbecued OYSTER! Yum!

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