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.




--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[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