Worm/Passwords

Jonathan Bayer jbayer at ispi.UUCP
Fri Nov 25 02:11:25 AEST 1988


In article <135 at minya.UUCP>, jc at minya.UUCP (John Chambers) writes:
> In article <466 at yarra.oz.au>, cm at yarra.oz.au (Charles Meo) writes:
> Once again, it's time to mention the dark side of modifying rm:  Lots of
> applications need a way to unconditionally remove files, and for scripts,
> rm is the tool of choice.  If the user runs a script, do you really want
> the user to be forced to verify that it is OK to remove all the script's
> /tmp files?  I've seen it happen, and many users don't consider that to
> be particularly user-friendly.
> 

Another possibility is to have rm check for two things:  one, is stdin a
tty (use the isatty() function).  If it isn't, emulate the normal rm.  Second,
for a user, if only one file is being removed then go ahead and do it. 
Otherwise, prompt for each file.  

I have implemented a "safe" rm on my system doing the above.  It also moves
the removed files to a trashcan directory instead of deleting them.  It
has a force option (turns off the safe mode), a verbose option, and others.
If there is interest I will mail to a few requests, if a lot of requests
I will post it instead. 

The normal system rm has been moved to "rm2", which is used by a daily
cron script which cleans out the trashcan directories on a daily basis.  Only
files which  are 7  days old or older are removed.

This program is based on an old posting.  The poster's name escapes me
at this point in time, but credit is given in the program.

Jonathan Bayer
Intelligent  Software Products, Inc.



More information about the Comp.unix.wizards mailing list