Bugzilla – Bug 656
sudoedit creates files with group root instead of primary group of -u target
Last modified: 2014-09-24 09:32:44 MDT
Assuming a user "foo", with primary group "foo", do the following: sudo -u foo -e /tmp/bar The resulting file will be owned by "foo:root", not "foo:foo" as might be expected based on the behavior of other commands. A workaround is to do the following: sudo -u foo touch /tmp/bar sudo -u foo -e /tmp/bar That works as expected. Confirmed this in multiple 1.8.x versions, including 1.8.4p5 (from upstream, no patches), 1.8.6p3 (as shipped in RHEL 6), and 1.8.6p7 (as shipped in RHEL 7).
This is fixed in sudo 1.8.11, currently in beta.
Just FYI, if you are creating a file in a directory mounted with BSD group semantics (the grpid or bsdgroups mount option in Linux) the new file will inherit the group of the parent directory and not the runas user.
Created attachment 420 [details] Fix for zero gid on new sudoedit files I believe this is the root of the problem.
Fixed in sudo 1.8.11.