Windows – How to set default group for files created in Samba share

sambawindows

I'm sharing a directory, /home/pi/pydev on a debian box (raspberry pi, in fact) with Samba. I'm reading from and writing to that directory from a Windows 7 machine.
When I create, under W7, a file in that directory, it gets 0764 rights, and it's owned by user rolf and group rolf – that's me on the W7 machine.

User pi on the debian box and user rolf (on W7) both need to be able to modify files in that directory, so I made them both member of group coders, hoping I could configure it so that members of coders have at least read & write access to files in that directory. .

But user pi can't modify any file that belongs to group rolf.

I could chmod rolf:coders <filename> file by file.
Adding user pi to group rolf is ugly, and doesn't work (didn't expect that. Does Samba maintain an entirely different user administration with groups, beside Debian's?).
I could also log on to the debian machine as rolf, and navigate to that folder.

But the most elegant way (to me) would be if a file created by rolf from the W7 machine would get userid rolf and groupid coders, by default.

Can I configure Samba to do that, or is there some other way to automate that task?

Best Answer

If I understand what you are asking correctly then what you want is inside the smb.conf located here:

   /etc/samba/smb.conf

Add these options to the [global] section:

   force user = rolf
   force group = coders
Related Question