[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: permissions and fstab



Hi Marcello,

On Mon, Mar 26, 2001 at 06:04:21PM -0300, Marcelo Chiapparini wrote:

> I have a dos partition  which belongs to a win98 disk. I need to access 
> this dos partition from linux, in order to write some stuff on it. This 
> partition 
> is mounted automatically at startup trhough the appropriate entry in the fstab 
> file. The problem are the permissions. This dos partition has root as owner, 
> so I don't have permission to write to it from my personal account. How can I 
> fix it at boot time? i.e I need this partition mounted with the correct 

[[ untested, mainly from reading the fine manuals (but admittedly prior
   to your question)  ]]

There are basicly three ways to handle this.

1) Remount per user:
   in /etc/fstab change the entry for that dos partition like this:

   /dev/hda1	/winfun vfat	defaults,user			0 2

   this will allow any user on your system to unmount that dos partition
   and to remount it.  Remounting it will allow that user to write to it,
   but not others.  But ofcourse at any time others could remount it too,
   putting the first user again in a situation where he can't write to it.

2) Mount by root, but for a specific user:
   in /etc/fstab change the entry for that dos partition like this:

   /dev/hda1 /winfun vfat defaults,uid=1001,gid=1001,noexec,nosuid,nodev 0 2

   this will allow root but also the user with uid 1001 and gid 1001
   to read and write to that partition. Only root can mount it.
   [[ I've added the flags noexec,nosuid,nodev as they were implied by
      the user flag ]]

3) Mount by root, but with very permissive file permissions:
   in /etc/fstab change the entry for that dos partition like this:

   /dev/hda1	/winfun vfat	defaults,umask=000,noexec,nosuid,nodev	0 2

   this allows any body to read/write to this partition, but only root
   can mount it.

4) Combine 2 and 3:
   in /etc/fstab change the entry for that dos partition like this:

   /dev/hda1 /winfun vfat defaults,gid=1500,umask=002,noexec,nosuid,nodev 0 2

   This will allow root and any user with gid 1500 to write to it. Every
   body can read from it, but only root can mount it.


In my home situation I prefere 1: the windows partitions are readonly
by default, yet accessible at will.  In les friendly environments I
would prefer 4:)  One could even try a combination of 1, 2 and 3
-adding the benifit of read-only per default-, but I think it won't
work, as malicious users could repeatedly remount it, preventing any
real work to be done.

-- 
groetjes, carel



Reply to: