Manage permissions for automounted windows partitions
Posts: 10
First of all, here is my fstab:
# Pluggable devices are handled by uDev, they are not in fstab
/dev/hda3 / ext3 defaults,noatime 1 1
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
-> /dev/hda1 /mnt/win vfat,ext3,ext2,reiserfs auto,exec 0 0
-> /dev/hda5 /mnt/data vfat,ext3,ext2,reiserfs auto,exec 0 0
# Dynamic entries below, identified by 'users' option
/dev/hda4 swap swap sw,pri=1 0 0
hda1 is my Windows partition, and hda5 is a fat32 partition that I use to share my files between Windows and Linux. I wanted these two partions to be mounted automatically at boot, and it works, but I also want to manage permissions for /mnt/win and /mnt/data. In fact, only root can read/write in these repertories, and if I try to change permissions when they are already mounted, an error message tells me that I don't have permissions to do it, even as root! Instead, if I change the permissions when the partitions aren't mounted, it works, but at the mount time, the permissions are automatically changed back.
To control the access for the different users, I created two users groups: mnt_win and mnt_data. Mnt_win must be the owner group of /mnt/win and mnt_data must be the owner group of /mnt/data. Furthermore, I want the permissions of the two folders to be rwxrwx---.
So, how the hell can I do this? Your help will be appreciated a lot since I passed almost an entire week on this one.
The solution
Posts: 10
I finally found the solution to my problem, since about a few months now, and I wanted to share it with other people. It works perfectly. To give a user read/write access to hda1, I put it in the group mnt_win, or mnt_data for hda5. So, here is my fstab.
# Pluggable devices are handled by uDev, they are not in fstab
/dev/hda3 / ext3 defaults,noatime 1 1
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
/dev/hda1 /mnt/win vfat,ext3,ext2,reiserfs auto,exec,umask=1007,uid=0,gid=1000 0 0
/dev/hda5 /mnt/data vfat,ext3,ext2,reiserfs auto,exec,umask=1007,uid=0,gid=1001 0 0
# Dynamic entries below, identified by 'users' option
/dev/hda4 swap swap sw,pri=1 0 0
/dev/cdrom /media/cdrom iso9660,udf noauto,users,exec,ro 0 0
gid is the group ID of the owner group (in my case, mnt_win or mnt_data), and umask is the same as chmod, except that you specify wich rights you are denying, instead of granting them. 0000 as the umask is equivalent to 7777 as the chmod. uid is the user ID of the user owner, root in my case.
And thanks for your help!
umask
Posts: 363
satanik,
I believe you need to specify a value for umask in fstab, then after booting you can change ownership.
I had a similar problem, see
http://www.mepis.org/node/10676
Good luck!
Andy