need help with SafeDelete

Peter Samuelson peter at
Wed May 24 17:35:30 GMT 2000

[Keith Muska <kmuska at>]
> I found a program that I think may be usefull if I can get it to work
> with Samba.  I am using RedHat 6.2 and I found a program included
> with the PowerTools called safedelete-1.3.  I read the man page for
> safedelete and it mentions creating a system alias "alias
> rm='/usr/bin/safedelete'" so when you use rm to delete a file it will
> get backed up to a specified folder.

This is the same problem with most undelete utilities/hacks I have
seen.  They work fine for any program or shell that actually invokes
/bin/rm -- you just replace /bin/rm with your hack and you're good to
go.  Unfortunately, they do nothing for the unlink() and rmdir() system
calls that actually handle deletion.  Samba, just like Emacs, doesn't
go through the shell to delete things, and it doesn't call `rm'.  So
these programs won't work for them, won't work for most programs.  This 
is the same issue with those "file versioning" bolt-ons.

Some time ago I wrote a working prototype of a "recycle bin" for Samba,
whereby a share-specific parameter "recycle bin =" specified where
deleted files should go.  It had several limitations and I never got
around to fixing them.  (I still hope to someday, as several people
expressed interest in such a facility.)  But it did demonstrate that
hacking things like this into the Samba source really isn't very hard.
Just grep for the remove(), unlink() and rmdir() system calls and do
your thing.

Happy hacking.


More information about the samba mailing list