*BSD News Article 57201


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!newsfeed.internetmci.com!info.ucla.edu!library.ucla.edu!agate!soda.CSUA.Berkeley.EDU!mconst
From: mconst@soda.CSUA.Berkeley.EDU (Michael Constant)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: chmod'ing msdos fs and mount problems
Date: 14 Dec 1995 07:22:11 GMT
Organization: Society for the Prevention of Cruelty to Vegetables, UC Berkeley
Lines: 62
Message-ID: <4aojb3$4ir@agate.berkeley.edu>
References: <4acqam$2m8@ccshst05.cs.uoguelph.ca>
NNTP-Posting-Host: soda.csua.berkeley.edu

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.
>
>chmod 700 /dos doesn't seem to touch the directory entires, so I'm 
>wondering, how DO i block off access to these two directories?

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

The reason you change the permissions when it is unmounted is that
the msdos filesystem really doesn't actually have permissions at all!
If you run chmod on a file in the msdos partition, including the root
directory, you aren't actually changing anything, because there *are*
no permissions on the filesystem.  The only permissions you see are
the ones that are faked by mount_msdos.  The reason it works if you
chmod the /dos directory when the partition is unmounted is that when
you mount the partition, mount_msdos looks at the permissions of the
mount point (here, /dos) and uses those permissions for the entire
directory structure.  You can also control the permissions via command
line options to mount_msdos, as another poster suggested.

You can set up more interesting permissions, if you want.  On my system,
I created a group "dos" and set up my dos partition like this:

# chmod 750 /dos
# chown root.dos /dos

This gives root full access to the dos partition, and lets everyone in
group "dos" read from it but not write to it.

(BTW: a useful feature for the msdos filesystem would be to allow the
mounting of a dos subdirectory as an entire partition, so that you
can control the permissions on it -- e.g. I could mount c:\public on
/pubdos with permissions 755, and mount c:\ on /dos with 700.)

>which leads me to me second question.  When i load /dos2, which is an IDE 
>1.03GIG drive (second physical drive), I get "mountmsdosfs(): root 
>directory is not a multiple of the clustersize in length".  I don't 
>really know what this means or what to expect when using the filesystem, 
>so I have disabled loading it for now.  Any ideas?

Strangely enough, that message means that the length of your root
directory is not a multiple of the cluster size :-)  This is an
indication that your cluster size is inconsistent with the size of the
dos partition.  Usually, this is because you have used FIPS on the
drive.  If so, you must back up everything on the drive and repartition
it *properly*, i.e. destructively.  This should fix that problem.

You are quite right to disable mounting of your /dos2 partition for
now.  The FreeBSD msdos filesystem cannot properly handly a partition
with inconsistent cluster size, and you may corrupt your data if you
mount it.
--
            Michael Constant (mconst@soda.csua.berkeley.edu)