LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Directory Mask is not properly working on samba shared folders (https://www.linuxquestions.org/questions/linux-server-73/directory-mask-is-not-properly-working-on-samba-shared-folders-712226/)

Prabagaran 03-17-2009 06:32 AM

Directory Mask is not properly working on samba shared folders
 
Hi All,

I have Fedora core 8 installed in my machine, in which I have shared certain folders (public) for windows access.
--------
Sample Configuration of my smb.conf

[common]
comment = Common to all
path = /mnt/common
writeable = yes
directory mask = 0777
; browseable = yes
write list = +staff
valid users = <list of " +staff " group members separated by comma, which got added automatically when "Only allow access to specific users" option is selected and given permissions to those who are only under "+staff" group through Samba Server Configuration Wizard using "system-config-samba" command>
--------

And the folder (in my case the folder name is "common") permission is set to 0777, where uid =<samba-user>, gid=+staff.

Example:

drwxrwxrwx 3 <samba-user> <staff> 12288 2009-03-17 15:40 common


The problem is, whenever a file which is under "common" (the public folder) is edited by any of the user who is under "+staff" group, the particular file's ownership and permission is got changed to that particualr user. If an another member user who is under the same "+staff" group tries to access the same file, he/she can view it as Read-only but cannot write to it, throws "no permission, access denied" error.

Example of a file whose permission and ownership got changed automatically after editing it (sample.txt) by a samba-user:

-rw-r--r-- 1 <samba-user> <samba-user> 6421767 2009-02-28 05:46 sample.txt

The same problem whenever a member of "+staff" group creates a new file or folder.
Example:

-rwxr--r-- 1 <samba-user> <samba-user> 0 2009-03-17 16:35 New Text Document.txt


My requirement is, there should be a public folder, where all can access, read and write but the permission and ownership shouldn't get changed after edited by any of the member who are under "+staff" group.

Suggestions and Solutions would be a great help !

Regards,
Prabagaran L.

chitambira 03-17-2009 07:34 AM

Try:

Quote:

[common]
comment = Common to all
path = /mnt/common
writeable = yes
create mask = 770
directory mask = 770
valid users = @staff_group
read only = No
force group = staff_group

cyprinidae 03-17-2009 07:38 AM

You need to set SGID for the directory
Code:

# chmod g+s /mnt/common
so if any of the users create a file in the directory, it will be marked with staff as the group, even though their primary group is different


All times are GMT -5. The time now is 03:00 AM.