[comp.unix.questions] mount points not special

dnb@chaos.cs.brandeis.edu (David N. Blank) (07/01/90)

Howdy-
  I have had this evil situation happen a couple of times at sites I
administer (by people other than me), and was curious if this is
specific to my opsys (NCR SYSV brand UNIX):
    Under this system a disk is partitioned into some number of
logical partitions.  These partitions are then mounted as separate
file systems at some mount point in the file system tree.  For
instance, attached to /usr can be a file system from another partition
called happy (to become /usr/happy for all of our gleeful users).  So
far so good.
    I have seen situations where someone has done a recursive rm on a
directory higher up in the tree that blows away the mount point
directory (ie. rm -r /usr makes /usr/happy go bye-bye).  Then you get
to argue with the mount command about the status of that partition
'cause someone is getting confused (besides the idiot user who did the
rm in the first place). 
    My question: do other opsys's designate these mount point
directories more invulnerable to rm's, or is mine just dain bramaged?
Is there a bright way to prevent this from happening again (besides
taking the person who keeps on doing this out back to be shot)?
Thanks muchly in advance.
     Peace,
       dNb

art@pilikia.pegasus.com (Art Neilson) (07/02/90)

This is perfectly normal, what do you expect to happen if you remove a
directory a filesystem expects to be mounted on ?  When mount tries to
mount the filsystem on a non-existent directory, it of course will fail.
Your best defense against rm is to set the directory and file permissions
such that they cannot be rm'ed by your users.
-- 
Arthur W. Neilson III		| ARPA: art@pilikia.pegasus.com
Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pegasus!pilikia!art

dnb@chaos.cs.brandeis.edu (David N. Blank) (07/02/90)

Actually, I kind of expected this to be "normal" behavior, but was
looking for a trick to prevent it (or discussion on what could be 
added to the opsys which to prevent you from shooting yourself
in the foot).  The user in question actually has root privs on that
machine (not my decision), and blew it under that auspice.  How about
having a message like "Directory busy" appear while leaving the
directory intact, similar to the one you receive when you attempt to
remove a directory which still has files in it?  
                Peace,
                  dNb

gary@sci34hub.UUCP (Gary Heston) (07/03/90)

In article <DNB.90Jul2103510@chaos.cs.brandeis.edu> dnb@chaos.cs.brandeis.edu (David N. Blank) writes:
>Actually, I kind of expected this to be "normal" behavior, but was
>looking for a trick to prevent it (or discussion on what could be 
>added to the opsys which to prevent you from shooting yourself
>in the foot).  The user in question actually has root privs on that
>machine (not my decision), and blew it under that auspice.  How about
>having a message like "Directory busy" appear while leaving the
>directory intact, similar to the one you receive when you attempt to
>remove a directory which still has files in it?  

Write a semi-intelligent script and replace rm with it. If the -r option
is specified, check to see whether or not the current directory contains
less than two slashes. If so, uuencode the kernel and dump it to the
users' tty to indicate that they did something wrong....

Two slashes? Yes, if `pwd` doesn't return something with a path
similar to /usr/idiot, the script would fail. Move the real
rm to someplace obscure and rename it (something like /usr/lib/obscure.h)
to prevent from being used directly.

Of course, the alternate course you mentioned not only prevents the
user in question from repeating the offense, but discourages others
from following in his recursive path....  :-)

Writing a script to count occurrences of a character in a string is
left as an exercise for the user...

-- 
    Gary Heston     { uunet!sci34hub!gary  }    System Mismanager
   SCI Technology, Inc.  OEM Products Department  (i.e., computers)
"The esteemed gentleman says I called him a liar. That's true, and I
regret it." Retief, a character created by Keith Laumer.