FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 02-05-2010, 12:08 AM
suvayu ali
 
Default No /sbin PATH after sudo in Fedora 12 even after the PATH is added in .bash_profile

On 4 February 2010 16:13, Tom Horsley <tom.horsley@att.net> 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?

--
Suvayu

Open source is the future. It sets us free.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
 
Old 02-05-2010, 12:23 AM
suvayu ali
 
Default No /sbin PATH after sudo in Fedora 12 even after the PATH is added in .bash_profile

On 4 February 2010 17:14, Ed Greshko <Ed.Greshko@greshko.com> wrote:
> suvayu ali wrote:
>> On 4 February 2010 16:13, Tom Horsley <tom.horsley@att.net> 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

Ah! that explains it. Thanks!
--
Suvayu

Open source is the future. It sets us free.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
 
Old 02-05-2010, 12:24 AM
Sam Sharpe
 
Default No /sbin PATH after sudo in Fedora 12 even after the PATH is added in .bash_profile

On 5 February 2010 01:14, Ed Greshko <Ed.Greshko@greshko.com> wrote:
> suvayu ali wrote:
>> On 4 February 2010 16:13, Tom Horsley <tom.horsley@att.net> 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

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?

--
Sam
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
 

Thread Tools




All times are GMT. The time now is 04:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org