Jeremy Carhanter
2012-Aug-14 16:58 UTC
[Samba] Strange issue with deleting files on shares
Hi All, I am migrating one of the servers I have to administer and I came across this issue. It is going to be a little bit complicated to describe, but I'll do my best. First the configurations: OLD SERVER: CentOS release 5.3 (Final), kernel 2.6.18-128.el5, samba version 3.0.33-3.7.el5 CURRENT SERVER: Ubuntu 12.04 LTS, kernel 3.2.0-29-generic, samba version 3.6.3 CLIENTS: Mix of Windows XP SP3 and fullly updated Windows 7 If anything else about the configuration will be necessary, just let me know. What we need, is a samba share that is fully writable, but with undeletable files. With undeletable directories exactly, files on the other hand, must be deletable (because of the way MS Word edits files) . So far it works very well, but my suspicion is, that the behavior we have now between the server and the clients isn't configurable. The directory which is the root of the share is owned by root and has the sticky bit on. So do all the subdirs and when some client creates new dir, this is achieved by a cron script (for a small amount of time, the directory is owned by the original creator and without the sticky bit set, but that is ok), that changes the owner to root and sets the sticky bit on each directory not owned by root. Filesystem rights are set to rwxrwxrwx (chmod 1777 is used in the cron script) so everybody can write everywhere. When some client (they of course connect as other users than root) deletes a directory an error screen appears, the directory doesn't get deleted and so does NOTHING inside of that directory. By nothing I mean also the files, owned by the user who wanted to delete the directory. If I do this from a linux box (connect as the same user as from windows, same rights, same server, same files, same everything, just connecting from linux) the deleting is applied recursively, meaning that samba traverses all subdirs of the directory I wanted to delete and in each of these subdirs (and their subdirs and so on) deletes files owned by me. And here is where the problem comes... On the new server, this linux-specific behavior applies also to windows clients. If I delete some directory, which has the sticky bit set and is owned by root I do see an error about permissions but all files owned by me in all of the subdirs of this directory get deleted. And that is something that is not allowed to happen. So, my question is, am I missing something and is this somehow configurable? Or did the deleting operation in samba source code changed so much, that this "bug" we are happily using has been fixed and the recursive deleting is how it should correctly be done? And if so, are there any suggestions how to achieve the behavior we have now, except for staying with the old version of samba? Thank you all for your help and I apologize for my English. Cheers, Jeremy