R: [Samba] Samba rewrite file's owner
John H Terpstra
jht at samba.org
Thu Jul 31 16:46:44 GMT 2003
On Thu, 31 Jul 2003, Samuele Brignoli wrote:
> I've got two group "groupA" and "groupB". My user say "userA" is part of
> "groupA" and "groupB".
> Another user "userB" is part only of "groupB". userB create a file "fileX".
> userA modify this file.
> the final result is that now the fileX is owned by userA with group "groupB"
> and so it's no more
> readable by userB. This conceptually overrides the creator concept that was
> "userB". How can I manage this
> situation in a clear way?
Please, please do some homework before posting this type of request.
The facts, as mentioned many many times on this list is that Microsoft
Word does the following when you modify/change a Word document:
1. Word Creates a NEW document with a temporary name
2. Word then closes the old document and deletes it
3. Word then renames the new document to the original document name
There is NO mechanism by which Samba CAN IN ANY WAY know that the new
document really should be owned by the owners of the original file. Samba
has no way of knowing that the file will be renamed by MS Word.
Precisely HOW would you like the Samba-Team to modify Samba to "preserve"
ownership and permissions? As far as Samba is able to tell, the file that
gets created is a NEW file, not one that the application (Word) that
creates it has open.
There is a work-around to solve the permissions problem. That work-around
involves understanding how you can manage file system behaviour from
within Samba smb.conf configuration, as well as understanding how Unix
file systems work.
In short:
- set on the directory in which you are changing word documents
chmod g+s 'directory_name'
This ensures that all files will be created with the group that owns the
directory.
- in smb.conf share declaration section set:
force create mode = 0660
force directory mode = 0770
These two setting will ensure that all directories and files that get
created in the share will be read/writable by the owner and group.
This is well documented in the Samba-HOWTO-Collection.pdf for Samba-3.0.0
that is available off the Samba web site, that ships with Samba-3.0.0
betas. Refer to chapter 13, in particular a specific example in the Common
Errors section of this chapter.
This should solve your problem.
- John T.
>
> Thanks, Samuele.
>
> -----Messaggio originale-----
> Da: Michael Noble [mailto:mgnoble at cox.net]
> Inviato: Tuesday, July 29, 2003 3:32 AM
> A: samuele.brignoli at darpha.com
> Cc: samba at samba.org
> Oggetto: Re: [Samba] Samba rewrite file's owner
>
>
> This is due to the way microsoft works (at least office). When a
> file is edited, Microsoft creates a temp file for the edit session
> and locks the original. When you write the file, the original is
> deleted and the temp file is renamed to the original file.
> Since the temp file is owned by the new user, after write the new
> file is owned by the user who edited the file.
>
> Mike
>
> On Monday 28 July 2003 05:58 am, Samuele Brignoli wrote:
> > I've tried to share a file with two users logged in a samba PDC. Their
> > username are user1 and user2. If I create a file with user1 and then
> change
> > it with user2, the final owner's user of the file is user2. Isn't it a
> > strange behaviour ?
> >
> > Thanks in advance, SB.
>
>
>
--
John H Terpstra
Email: jht at samba.org
More information about the samba
mailing list