SuSE 8.2/Samba 3.0.4-SerNet-SuSE One expects file's owner and date to be preserved when copying a file to an SMB share. But if a file with the same name is already there there are two different ways as to who will ultimately own the new file and what date will be stamped depending upon whether the file belongs to the copier or to someone else. If I try to copy a file to a samba share which already contains an earlier version of the same file, the file will still belong to me and the date will be the date of the source file. But if I copy a file over an existing homonymous file which belongs to someone else, then the file fill still belong to that other user but the date will be the date at the moment of copying. I've noticed that in both cases an overwritten file keeps the same i-Node number (xfs), which is a little unexpected. I'd expect the old file to be deleted and a new one created but perhaps accidentally it's always the same free i-Node which gets assigned to it. Is there a way to correct this behaviour? I mean, if a file with the same name gets overwritten by copying it should belong to the copier and carry its original modification date, not the update time.
Dragan Krnic
2004-Aug-25 18:22 UTC
[Samba] Re: copying over an existing file when not owner
> SuSE 8.2/Samba 3.0.4-SerNet-SuSE > > One expects file's owner and date to be preserved > when copying a file to an SMB share. But if a file > with the same name is already there, there are two > different results as to who will ultimately own the > new file and what date will be stamped depending > upon whether the file belongs to the copier or to > someone else. > > If I try to copy a file to a samba share which > already contains an earlier version of the same > file, the file will still belong to me and the > date will be the date of the source file. > > But if I copy a file over an existing homonymous > file which belongs to someone else, then the file > will still belong to that other user but the date > will be the date at the moment of copying. > > I've noticed that in both cases an overwritten > file keeps the same i-Node number (xfs), which is > a little unexpected. I'd expect the old file to be > deleted and a new one created but perhaps > accidentally it's always the same free i-Node > which gets assigned to it. > > Is there a way to correct this behaviour? > > I mean, if a file with the same name gets overwritten > by copying it should belong to the copier and carry > its original modification date, not the update time.Just in case a more recent version of samba should be proposed, I've tested SuSE 3.0.5 and SerNet-SuSE 3.0.6 as well and the behaviour is always the same wrong one. This behaviour breaks the propagation of updates in some applications because they erroneously depend upon datestamp instead of a CRC or similar, but it is also an incompatibility to an MS SMB server.
Dragan Krnic
2004-Aug-26 22:54 UTC
[Samba] Re: copying over an existing file when not owner
|> If I try to copy a file to a samba share which |> already contains an earlier version of the same |> file, the file will still belong to me and the |> date will be the date of the source file. |> |> But if I copy a file over an existing homonymous |> file which belongs to someone else, then the file |> will still belong to that other user but the date |> will be the date at the moment of copying. | | Try setting 'dos filetimes = yes'. See the smb.conf(5) | man page for details. Read the darned manual. Thank you, Gerald. I must have mixed "dos filetimes" with the notion of dos time resolution. It solves my problem and it says so.