I think pretty much people here mistakenly 'rm -rf
'ed the wrong directory, and hopefully it did not cause a huge damage.. Is there any way to prevent users from doing a similar unix horror story?? Someone mentioned (in the comments section of the previous link) that
... I am pretty sure now every unix course or company using unix sets rm -fr to disable accounts of people trying to run it or stop them from running it ...
Is there any implementation of that in any current Unix or Linux distro? And what is the common practice to prevent that error even from a sysadmin (with root access)?
It seems that there was some protection for the root directory (/
) in Solaris (since 2005) and GNU (since 2006). Is there anyway to implement the same protection way to some other folders as well??
To give it more clarity, I was not asking about general advice about rm
usage (and I've updated the title to indicate that more), I want something more like the root folder protection: in order to rm -rf /
you have to pass a specific parameter: rm -rf --no-preserve-root /
.. Is there similar implementations for customized set of directories? Or can I specify files in addition to /
to be protected by the preserve-root option?
rm
command with one that doesn't have that feature.rm -rf
can be a resume generating event. Check and triple check before executing it