SetUID/SetGID Kernel Option

Jonathan McKeown j.mckeown at ru.ac.za
Thu Jun 4 14:44:58 UTC 2009


Hi Martin

On Thursday 04 June 2009 16:23:29 Martin McCormick wrote:

> 	I have been asked to enable the following kernel option:
>
>    SetUID/SetGID - Allow directories to inherit their owner from the
>    parent directory.
>
> The generic kernel under FreeBSD6.3 is what we presently use on
> the system in question and I see no commented-out option for
> compilation.

You need to add

option SUIDDIR

To the kernel config. You can find a sample line in /sys/conf/NOTES

> 	We see in the fstab the following:
>
> # Device		Mountpoint	FStype	Options		Dump	Pass#
> #Default is for no SUIDDIR.
> #/dev/mfid0s1a		/		ufs	rw		1	1
> #Living a bit more dangerously, we turned it back on.
> /dev/mfid0s1a		/		ufs	rw,SUIDDIR 1	1
>
> This looks like it may address the issue, but a test shows that
> it does not appear to happen.

Once you've recompiled the kernel you also need to use suiddir in the mount 
options for any filesystem where you want file ownership to be inherited from 
the directory.

It's described in the kernel notes and in the mount manpage as a dangerous 
option which opens security holes.

I notice that you mention setGID as well, which under sysV-derived systems 
allows file to inherit group ownership from the directory. If that's what's 
wanted, you don't need to do anything, as the behaviour that's optional on 
sysV systems like Linux is the default behaviour on FreeBSD.

Jonathan


More information about the freebsd-questions mailing list