Re: trick question about sudo

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

 



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.





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux