home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / question / 15261 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.5 KB  |  66 lines

  1. Newsgroups: comp.unix.questions
  2. 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
  3. From: reddyp@ucunix.san.uc.edu (Pardhasaradhi A. Reddy)
  4. Subject: Re: a simple question about rm
  5. Message-ID: <C0Hpqy.3xx@ucunix.san.uc.edu>
  6. Organization: University of Cincinnati
  7. References: <C0DwyB.5Ht@news.cso.uiuc.edu> <1993Jan5.175040.483@ll.mit.edu>
  8. Distribution: usa
  9. Date: Thu, 7 Jan 1993 15:30:34 GMT
  10. Lines: 54
  11.  
  12. In article <1993Jan5.175040.483@ll.mit.edu> yasu@ll.mit.edu (Alan Yasutovich) writes:
  13. >In article <C0DwyB.5Ht@news.cso.uiuc.edu> hpcg9070@uxa.cso.uiuc.edu (H Prasad Cherukuri) writes:
  14. >>
  15. >>I have the following question about rm. 
  16. >>
  17. >>When using rm with the option -r to remove files in a directory recursively
  18. >>in interactive mode(I have an alias set up for rm so that I am prompted to 
  19. >>verify everytime I want to remove a file), I noticed that I am asked to
  20. >>verify twice to remove a directory.
  21. >>
  22. >>For example, suppose that I have an empty directory called "junk". So
  23. >>I enter at the prompt:
  24. >>
  25. >>    $rm -r junk
  26. >>    directory junk: ?(y/n) y
  27. >>    junk: ? (y/n) y
  28. >>    $
  29. >>
  30. >>My question is why does the machine ask me twice? I noticed that if I
  31. >>say yes to the first question and no to the second question, it doesn't
  32. >>do anything(it doesn't remove the directory junk).  
  33. >>
  34. >>I am asking this out of curioisity as I am not very familiar with
  35. >>computers. Pardon me if this is too dumb a question.
  36. >>
  37. >>
  38.  
  39.     When you use rm on a directory, the first question in your
  40.     example quoted above is to confirm if you wish to remove the
  41.     contents of the directory "junk". The second question is to
  42.     confirm if you wish to delete the directory(is also a file)
  43.     "junk".
  44.  
  45.     To understand this better, try creating a directory inside
  46.     another along with some files in each directory. I work on
  47.     a Ultrix machine here. (ofcourse, if the directory is read only,
  48.     you certainly cannot remove it).
  49. >
  50. >
  51. >    Here's another one.  Why can root remove stuff if
  52. >    all permissions are off.  I did a test once to see if
  53. >    I could use this as a mask, and it failed.
  54. >
  55. >-- 
  56.  
  57.     The simplest reason could be that system does no checking for
  58.     permissions once it finds that the uid is 0. (i could be 
  59.     wrong). In other words, the uid is checked first and then
  60.     if the uid is not 0, is goes on to check for permissions.
  61. -- 
  62.  Disclaimer : Views expressed by me are purely mine and have nothing to
  63.  do with those of my employer's or any Organization. Reader diescretion
  64.  is strongly advised.
  65.  
  66.