# BUG:Files and directies in share owns the parent directory group in samba



## annapoorani (Apr 26, 2010)

"force group" with no effect on BSD 

I have found a problem in freeBSD 5.4 same as the problem in the following post:

http://lists.samba.org/archive/samba-technical/2001-April/013158.html
any solutions for this problem?




Thanks 
annapoorani


----------



## Zare (Apr 26, 2010)

You'll have hard time convincing someone to go bugchasing FreeBSD 5.4


----------



## SirDice (Apr 26, 2010)

5.x is end of life and has been EOL for quite some time.


----------



## annapoorani (Apr 26, 2010)

I mentioned a wrong version .I found a bug in FreeBSD 8.0 only


----------



## annapoorani (Apr 27, 2010)

In FreeBSD 8.0


```
cd /root/test; id; touch testfile; mkdir testdir; ls -la
> uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)
> drwxr-xr-x   2 nobody  wheel   2 Sep 16 22:10 testdir
> -rw-r--r--   1 nobody  wheel   0 Sep 16 22:10 testfile
```
New files get the same group as the directory 

I need to change this behaviour such that when I create a file, its group must be same as the creating user's group.(i.e similar to sysV way).Is it possible to achieve that in FreeBSD 8.0?

Thanks
poorani


----------



## SirDice (Apr 27, 2010)

I think you can archive that by setting the sticky bit on the directory.

See sticky(8) and chmod(2).


----------



## annapoorani (Apr 27, 2010)

*Sticky bit not working in sysv way*

I set stickybit  in a folder using

`chmod +t testshare`


```
ls -ld /testshare/
drwxrwxrwt  2 20017  wheel  512 Apr 27 12:32 /testshare/
```

Then login as other user and created a file in testshare


```
0 -rw-r--r--  1 sri    wheel  0 Apr 27 12:32 t1
```

The group of the file is wheel only and what i am trying to achieve is to get the group of the user there.


----------



## SirDice (Apr 27, 2010)

Stop treating BSD as SysV. They're quite different.


----------



## annapoorani (Apr 27, 2010)

*BUG:Files and directory in share owns the parent directory group in samba*

Any work arounds?


----------



## Zare (Apr 27, 2010)

Yes, rewrite open() syscall to match your needs, since creat() has been obsoleted and isn't used to create files any more. Or you can patch samba to manually chmod files after they've been copied. There are a lot of ways, if you have time and skills.


----------

