Windows Partitions

From SlackWiki
Revision as of 10:25, 9 December 2011 by Merge-delete (talk | contribs)
Jump to navigation Jump to search

One of the frequent questions on ##slackware is something along the lines of "How can I allow normal users to access my Windows partition?" There are *at least* two different ways of doing this.

For a FAT partition, you *could* add umask=0000 to /etc/fstab's options, but I personally don't recommend doing that. It's *your* computer, so you make the call, but I would do something along these lines:

1. If you want *every* user to be able to read and write to the partition, then you can add dmask=0000 and fmask=0111 to /etc/fstab's options and be done with it - problem solved.

/dev/hda1     /mnt/win98     vfat     rw,dmask=0000,fmask=0111     0   0

The reason for dmask/fmask as opposed to umask is quite obvious (though I hadn't thought about it until elohim on ##slackware pointed it out): The FAT and NTFS file systems don't "understand" the executable (-x) bit, so it's automatically present on every file in such a filesystem. There's no need for normal files to be executable (and it can indeed be a security risk), so we use fmask to turn off those permissions.

2. If you only want some users to be able to read and write to the partition, but you want *every* user to have read access, then you'll want something along these lines. First, create a special group called "windows" (change the name if you wish) by adding it to /etc/group using your favorite editor and add to this group the users you want to have write access.

nogroup:x:99:
users:x:100:
console:x:101:
windows:x:102:user1,user2,user3

Next, edit your /etc/fstab line for that partition and specify that it be mounted with group ownership of the "windows" group, and that write access be removed from others.

/dev/hda1     /mnt/win98     vfat     rw,gid=102,dmask=0002,fmask=0113     0   0

An NTFS partition will be mounted read-only, so you won't have write access for anyone, but the central idea is the same.

If you don't want everyone else to even have read access to the partition, you can easily do that with the above fstab line modified a bit:

/dev/hda1     /mnt/winXP     ntfs     ro,gid=102,dmask=0227,fmask=0337     0   0

If you prefer write access to the partition, then you can use ntfs-3g instead and something like this: All users can read the partition; only members of gid 102 can write:

/dev/hda1     /mnt/win98     ntfs-3g     rw,gid=102,dmask=0002,fmask=0113     0   0

Users of gid can read and write; nobody else can do anything:

/dev/hda1     /mnt/winXP     ntfs-3g     rw,gid=102,dmask=0007,fmask=0117     0   0

For more information, see the Permissions and Umasks and Fstab pages.

--rworkman (thanks to Erik for the pointers about dmask and fmask)