On Wed, Oct 09, 2013 at 04:26:20PM +0200, Bambero wrote:
> Hello
>
> I have a small php script which creates a file:
>
> --------------------
> #!/usr/local/bin/php-5.2 -q
>
> //set group ID to operator
> posix_setgid(5);
> posix_setegid(5);
>
> //set user ID to nobody
> posix_setuid($_uid);
>
> // create file
> touch('/tmp/permtest');
>
> echo 'getuid: ' . posix_getuid() . "\n";
> echo 'getgid: ' . posix_getgid() . "\n";
> echo 'getegid: ' . posix_getegid() . "\n";
> --------------------
>
> Script returns (as expected):
> ----------
> getuid: 2
> getgid: 5
> getegid: 5
> ----------
>
> But file created with that script has perms:
>
> -rw-r--r-- 1 operator wheel 0 Oct 9 16:16 permtest
>
> So it looks like the setgid not works ?
>
> Can anyone help ?
>
> Bambero
On *BSD systems, the group owner of a file is inherited from the directory.
-Otto