*BSD News Article 57423


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!Germany.EU.net!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: chmod'ing msdos fs and mount problems
Date: 20 Dec 1995 15:35:41 GMT
Organization: Private BSD site, Dresden
Lines: 60
Message-ID: <4b9agd$9jc@uriah.heep.sax.de>
References: <4acqam$2m8@ccshst05.cs.uoguelph.ca> <4aojb3$4ir@agate.berkeley.edu>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.3

mconst@soda.CSUA.Berkeley.EDU (Michael Constant) writes:
> The YossMan <yossman@osiris.cs.uoguelph.ca> wrote:
> >I am mounting two msdos filesystems, /dos and /dos2, at bootup.  I want 
> >to change the permissions so that no one but root will be able to even 
> >look at the filessystems.


MOUNT_MSDOS(8)           UNIX System Manager's Manual           MOUNT_MSDOS(8)

NAME
     mount_msdos - mount an MS-DOS file system

SYNOPSIS
     mount_msdos [-u uid] [-g gid] [-m mask] special node

DESCRIPTION
..
     The options are as follows:

     -u      Set the owner of the files in the file system to uid. The default
             owner is the owner of the directory on which the file system is
             being mounted.

     -g      Set the group of the files in the file system to gid. The default
             group is the group of the directory on which the file system is
             being mounted.

     -m      Specify the maximum file permissions for files in the file sys-
             tem.  (For example, a mask of 755 specifies that, by default, the
             owner should have read, write, and execute permissions for files,
             but others should only have read and execute permissions.  See
             chmod(1) for more information about octal file modes.)  Only the
             nine low-order bits of mask are used.  The default mask is taken
             from the directory on which the file system is being mounted.

So you should pass the above options to mount_msdos.  I think this
could be done by specifying -m=0700 (for example) in the `options'
field of fstab(5).  (I cannot test it due to an apparent lack of DOS
partitions. :)

> You have the right command, but the wrong timing.  You must execute
> the chmod command when the /dos partition is *unmounted*.  So, this
> sequence of commands should work:
> 
> # cd /
> # umount /dos
> # chmod 700 dos
> # mount -a

This does only work due to the behaviour of mount_msdos quoted above
(last sentence of my quote).  Normally, permissions of a mount point
directory are (mostly) shadowed by the mount itself, so changing them
is _not_ the most recommended way.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)