home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!babbage.ece.uc.edu!ucunix.san.uc.edu!reddyp
- From: reddyp@ucunix.san.uc.edu (Pardhasaradhi A. Reddy)
- Subject: Re: a simple question about rm
- Message-ID: <C0Hpqy.3xx@ucunix.san.uc.edu>
- Organization: University of Cincinnati
- References: <C0DwyB.5Ht@news.cso.uiuc.edu> <1993Jan5.175040.483@ll.mit.edu>
- Distribution: usa
- Date: Thu, 7 Jan 1993 15:30:34 GMT
- Lines: 54
-
- In article <1993Jan5.175040.483@ll.mit.edu> yasu@ll.mit.edu (Alan Yasutovich) writes:
- >In article <C0DwyB.5Ht@news.cso.uiuc.edu> hpcg9070@uxa.cso.uiuc.edu (H Prasad Cherukuri) writes:
- >>
- >>I have the following question about rm.
- >>
- >>When using rm with the option -r to remove files in a directory recursively
- >>in interactive mode(I have an alias set up for rm so that I am prompted to
- >>verify everytime I want to remove a file), I noticed that I am asked to
- >>verify twice to remove a directory.
- >>
- >>For example, suppose that I have an empty directory called "junk". So
- >>I enter at the prompt:
- >>
- >> $rm -r junk
- >> directory junk: ?(y/n) y
- >> junk: ? (y/n) y
- >> $
- >>
- >>My question is why does the machine ask me twice? I noticed that if I
- >>say yes to the first question and no to the second question, it doesn't
- >>do anything(it doesn't remove the directory junk).
- >>
- >>I am asking this out of curioisity as I am not very familiar with
- >>computers. Pardon me if this is too dumb a question.
- >>
- >>
-
- When you use rm on a directory, the first question in your
- example quoted above is to confirm if you wish to remove the
- contents of the directory "junk". The second question is to
- confirm if you wish to delete the directory(is also a file)
- "junk".
-
- To understand this better, try creating a directory inside
- another along with some files in each directory. I work on
- a Ultrix machine here. (ofcourse, if the directory is read only,
- you certainly cannot remove it).
- >
- >
- > Here's another one. Why can root remove stuff if
- > all permissions are off. I did a test once to see if
- > I could use this as a mask, and it failed.
- >
- >--
-
- The simplest reason could be that system does no checking for
- permissions once it finds that the uid is 0. (i could be
- wrong). In other words, the uid is checked first and then
- if the uid is not 0, is goes on to check for permissions.
- --
- Disclaimer : Views expressed by me are purely mine and have nothing to
- do with those of my employer's or any Organization. Reader diescretion
- is strongly advised.
-
-