[aklug] interesting rm behavior

From: <bryanm@acsalaska.net>
Date: Sat Dec 24 2011 - 06:21:08 AKST

I encountered interesting behavior of the 'rm' command. Here's
what I did:

bryan@atlantis:/tmp$ mkdir mydir
bryan@atlantis:/tmp$ touch mydir/myfile
bryan@atlantis:/tmp$ chmod u-w mydir
bryan@atlantis:/tmp$ ls -la mydir
total 3416
dr-x------ 2 bryan users 8 2011-12-20 06:42 .
drwxrwxrwt 14 root root 3461120 2011-12-20 06:42 ..
-rw------- 1 bryan users 0 2011-12-20 06:42 myfile
bryan@atlantis:/tmp$ rm -rf mydir
rm: cannot remove `mydir/myfile': Permission denied

Of course, "rmdir mydir" would fail because the directory is not
empty, and "rm mydir/myfile" would fail because the user does not
have permission to change the directory. I find it interesting,
though, that "rm -rf" (unix's nuclear option) fails to perform
the requested delete.

When done as root, however, "rm -rf mydir" performs the deletion.

Comments welcome.

--
Bryan Medsker
bryanm@acsalaska.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat Dec 24 06:21:15 2011

This archive was generated by hypermail 2.1.8 : Sat Dec 24 2011 - 06:21:16 AKST