[Samba] Windows XP deletes read-only files. Windows 98 does not.

Arjan Opmeer arjan at opmeer.net
Thu Sep 30 04:51:34 GMT 2004


On my computer I have a writable share where I force the file permissions to
be read-only when files are written. Also the "delete readonly" option is
kept at its default "no" value.

When I access this share using Windows 98 or smbclient, Samba will refuse to
delete files but writing new files is possible, just as I want it to be.

However, when I access this share using Windows XP and I choose to delete a
file and after I say OK to the "The file is read-only. Are you sure you want
to delete?" prompt, Samba really deletes this file.

I've been studying the debug logs and I believe the difference is that
Windows XP sets the "delete on close flag" when it has found out that the
file is read-only. Windows 98 does not use this flag but instead just tries
to delete the file which will be blocked by Samba.

After the file is closed by Windows XP, Samba obeys the "delete on close
flag" and happily deletes the file. Resulting in behaviour I don't want and
is in contradiction to what the "delete readonly = no" option promises to do.

Maybe a test should be added to the procedure that sets the "delete on close
flag" that will not allow this flag to be set on files that are read-only?


More information about the samba mailing list