trick question about sudo

Valent Turkovic valent.turkovic at gmail.com
Mon Feb 18 21:03:27 UTC 2008


On Feb 18, 2008 9:03 PM, Phil Meyer <pmeyer at themeyerfarm.com> wrote:
> Valent Turkovic wrote:
> > Hi,
> > I have one question about sudo.
> >
> > While looking for uid/gid override for samba mounts I found this solution:
> > sudo echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled
> >
> > But this obviously doesn't work on Fedora but this works:
> > sudo sh -c 'echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled'
> >
> > But the trick question is in which setups and which circumstances can
> > the first sudo work?
> >
> > Cheers,
> > Valent.
> >
> >
> >
> >
>
> The answer: Never
>
> Here is why: plumbing
>
> The command sudo as I type it, belongs to me, and the connections to it,
> ie: STDIN, STDOUT, and STDERR (file handles 0, 1, and 2) are owned by
> me, and controlled by the shell that I am in.
>
> These are attached by the shell/OS when sudo is run as a part of loading
> it, and well before the actual sudo code begins to execute.
>
> Think of it as plumbing and everything in the pipeline before and after
> the command is mine.
>
> mine >command> mine
>
> ls > /tmp/file
>
> /tmp/file is created with my permissions
>
> any_command > /tmp/file
>
> same
>
> sudo any_command > /tmp/file
>
> same
>
> command < /tmp/file1 > /tmp/file2
>
> /tmp/file1 must be readable by me
> /tmp/file2 must be writable by me
>
> Both sides of that pipe are performed as my user, regardless of the
> command being executed.
>
> Hope that helps.
>
>
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>


Thank you, it does...

-- 
http://kernelreloaded.blog385.com/
linux, blog, anime, spirituality, windsurf, wireless
registered as user #367004 with the Linux Counter, http://counter.li.org.
ICQ: 2125241, Skype: valent.turkovic




More information about the fedora-list mailing list