September 11 2017 | File::Path Security | Back Next |
Suppose you have a directory to which you have no apparent permissions:
$ mkdir -p /tmp/alpha/beta
$ chmod 0000 /tmp/alpha/beta
$ ls -l /tmp/alpha/ total 4 d--------- 2 jkeenan jkeenan 4096 Jul 20 12:22 beta
QUIZ: If you call rm -r -- without -f -- what happens?
You will be prompted before descending into, or removing, a write-protected directory.
You will have to type y at each prompt to get the same results as you would with rm -rf.
$ rm -r /tmp/alpha/beta rm: descend into write-protected directory '/tmp/alpha/beta'? y rm: remove write-protected directory '/tmp/alpha/beta'? y
$ ls -l /tmp/alpha/ total 0
If you type n at any prompt, you won't get as much recursive deletion as you probably want.
Home Last TOC | Copyright © 2017 James E Keenan | Back Next |