[mythtv-users] SUID not working

Dave Sherohman esper at sherohman.org
Thu Nov 3 23:50:35 EST 2005


On Thu, Nov 03, 2005 at 08:07:21PM -0800, Daniel Segel wrote:
> I can answer this for Gentoo, and maybe FC4 as well. The command 
> everybody is told to use to apply the SUID bit is 'chmod a+s 
> mythfrontend',

'chmod a+s'?!?  *shudder*  Granted, I may be a paranoid old admin,
but that sounds to me like the stuff of nightmares...

> and while this *should* apply the SUID bit to the User, 
> Group, and Other bits, in fact it only applies it to the User and Group 
> bits. It's probably designed that way so you don't open up permissions 
> to guest accounts and whatnot.

No, it's more likely to behave that way because SOID (set-id for other,
more commonly called "the sticky bit") has no effect on normal files,
so it only makes the file SUID (set-id for user) and SGID (set-id for
group).  Per `man chmod`:  "the Linux kernel ignores the sticky bit
on files.  Other kernels may use the sticky bit on files for system-
defined purposes.  On some systems, only the superuser can set the sticky
bit on files."

> The reason this is a problem is because the mythfrontend binary is 
> frequently installed with user:group set to root:root, and if you launch 
> it as a regular user then you're really launching it via the 'other' 
> bits. The solution is to 'chown root:users mythfrontend' and then do the 
> chmod a+s thing to it again. now if you launch it as a regular user (as 
> long as they are in the users group) it should run as root, with root 
> priority.

You have greatly misunderstood the function of the set-id bits.  If a
binary is SUID, then it runs with the owning user's user ID no matter
who runs it.  If it is SGID, it runs with the owning group's group ID
no matter who runs it.  This is why SUID/SGID have the potential to
introduce serious security issues.  If it worked the way you described,
then SUID would be meaningless - a special override to force a program
to run with the owner's permissions, but only when the owner runs it,
would effectively do nothing, since the owner would be running it with
his own permissions anyhow.

-- 
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
  - Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)


More information about the mythtv-users mailing list