Protection from the dreaded "rm -fr /"

Dmitry Karasik dmitry at karasik.eu.org
Mon Oct 4 03:15:30 PDT 2004


	Hi Giorgos!

On 02 Oct 04 at 10:51, "Giorgos" (Giorgos Keramidas) wrote:

 Giorgos> The reason I liked this idea is that root has zillions of other
 Giorgos> ways to destroy an entire system, but not many of them are likely
 Giorgos> to be the result of mistyping a single character as shown below:

 Giorgos> 	# rm -fr / home/someuser/*

I just wonder, if 'rm' is so fearful to you, why bother changing rm(1)?
Write a simple wrapper around, as many sysadmins do for their needs,
and use it instead of rm.

#!/usr/bin/perl -w
for (@ARGV) {die "$_ is a boo-boo!\n" if m/^\//}
exit system 'rm' , @ARGV;


-- 
Sincerely,
	Dmitry Karasik

---
catpipe Systems ApS
*BSD solutions, consulting, development
www.catpipe.net
+45 7021 0050  



More information about the freebsd-hackers mailing list