in reply to [OT] undo rm command ??

rm REMOVES files. There is no attention paid to recovery. Yes, you can sometimes forensically recover files that have been removed, but it is extremely unwise to rely on such recovery -- it's more fragile than you might imagine.

The better solution is this:

$ chown root:wheel /bin/rm $ chmod 0550 /bin/rm $ echo mv $* $HOME/.rmTrash/ >/usr/local/bin/rm.safe $ chown root:users /usr/local/bin/rm.safe $ chmod 0555 /usr/local/bin/rm.safe $ for dir in /home/*; mkdir $dir/.rmTrash > echo alias rm=rm.safe >> $dir/.aliases ; done

Then only root and the people in the wheel group can use the "real" rm, the rest will use the "safer" version. If you can't trust people in wheel, then you have bigger problems.

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

Replies are listed 'Best First'.
Re^2: [OT] undo rm command ??
by Anonymous Monk on Apr 20, 2010 at 14:08 UTC

    aliasing rm to mv does have its problems. For one thing mv doesn't support -r (as in rm -rf). Another is the trouble of when the user deletes two items of the same name. Also it enables the user to rm whole directories without using any special flags, whereas typical rm doesn't work that way.

    On our system (because we had a user delete the etc dir, we decided to get rid of rm) we created a shell script that parsed the cmdline for illegal mv options, and also put each duplicate rm'd item into a unique subdir that was identifiable by a timestamp/date.