Warning about rm
tupper at wanginst.UUCP
tupper at wanginst.UUCP
Wed Jul 16 03:30:22 AEST 1986
Today I ran the following command:
rm -r /student/tupper/.dead/.*
I was trying to remove alot of files with names like .signature, .login, .etc.
The shell expanded my wild card to include /student/tupper/.dead/. and
(this is the important part -->) /student/tupper/.dead/.. (that's "dot-dot")!
Now rm cleverly makes sure you don't remove "..", but it does not check for
".." at the end of a path name (it does strcmp of filename against "..").
Thus rm, recursivly removed /student/tupper/.dead/.. , which happens to
be my home directory (/student/tupper).
While I wait for the operator to restore my most of my account, I thought I
would pass my experience on for the benefit of others (I've already read
news).
More information about the Comp.unix.wizards
mailing list