setuid not working on directories, or am I doing something wrong?

Bill Moran wmoran at collaborativefusion.com
Fri Jul 25 13:20:35 UTC 2008


In response to Greg Larkin <glarkin at FreeBSD.org>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Bill Moran wrote:
> | $ whoami
> | wmoran
> | $ mkdir test2
> | $ sudo chown daemon:daemon test2
> | $ sudo chmod 6777 test2
> | $ ls -lah | grep test2
> | drwsrwsrwx   2 daemon  daemon   512B Jul 25 07:40 test2
> | $ touch test2/testfile.empty
> | $ ls -lah test2
> | total 8
> | drwsrwsrwx   2 daemon  daemon   512B Jul 25 07:41 .
> | drwxr-xr-x  59 wmoran  wheel    6.0K Jul 25 07:40 ..
> | -rw-r--r--   1 wmoran  daemon     0B Jul 25 07:41 testfile.empty
> |
> | Shouldn't testfile.empty show up as daemon:daemon? or am I
> | misunderstanding something about how setuid works?
> |
> | This is on FreeBSD 7, but I observe the same thing on 6.3 and 6.2.
> |
> 
> Hi Bill,
> 
> ~From what I've read, you have to take some extra steps to get this to
> work.  First, visit this page and search for "suiddir":
> 
> http://www.freebsd.org/cgi/man.cgi?query=mount&sektion=8&apropos=0&manpath=FreeBSD+7.0-RELEASE
> 
> I believe you have to run a kernel with the SUIDDIR option enabled, and
> then you have to mount your filesystem with the suiddir option, as
> described in the mount man page above.
> 
> Let us know if that works for you or not.

That explains it, Greg.  Thanks for the feedback.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran at collaborativefusion.com
Phone: 412-422-3463x4023


More information about the freebsd-questions mailing list