[Samba] juggling with file ownership

Gaurav Pathak gaurav.p at directi.com
Wed Dec 17 19:58:11 GMT 2003


Hi

I have implemented a samba file server shared by around 60 odd people.
The typical scenario that I want to achieve is this.

1) Every person has his own folder. He has read and write permission to
that folder.
2) Everybody should be able to write to the folder of every other user.
3) The files written into the folder should only be viewed,deleted etc
by the owner of that folder and nobody else.

For that I have created a group say "users" and added all the users in
that group. I gave the following permissions.

drwxrwxr-t    3 abcdef users     4096 Dec 18 00:38 abcdef

here "abcdef" is one of the users and "users" is the name of the group.
Now any other user will be able to copy file into this folder. At the
same time any user will not be able to delete the file because folder
"abcdef" has a sticky bit set. Only the person who copied the file and
abcdef will be able to delete file from the folder "abcdef".

But if a person create a directory inside "abcdef" then the case will be
different. Suppose a user "efghij" creates a folder named test inside
the folder of "abcdef", then it will be something like this..

drwxr-xr-t    2 efghij users     4096 Dec 17 00:00 New Folder
 
In this case the owner of folder "New folder" and all the files inside
it is "efghij". In this case "abcdef" will not be able to delete files
from inside " New Folder" even though the folder belongs to him..

I was trying to find some solution by which any folder that is created
inside "abcdef" will automatically have the owner set as "abcdef". This
will solve all my problem, there does not seem to be any option
available for that..

Setting the parent folder permission to 6775 does not solve the problem.
The files and folders created inside "abcdef" still has the ownership of
the user who created it, not of "abcdef"..

Another option suggested is force user option but in that case every
operation will be run as that user which will mean that any user will be
able to delete file etc from that folder, something that I do not want.

Please help me if there any way by which I can achieve my requirement.

Thanks in Advance
Gaurav



More information about the samba mailing list