####[ How-Do-I Documents ]####################################### Sub : User read-write in M$ partitions HDI #004 How-Do-I get read and write permissions to M$ partitions mounted as msdos or vfat ? ################################################################# 1. Problem Definition 1.1 There is an inharent difference between *nix (ext2, ext3 and M$ partitions (msdos/ vfat), since the latter does not support ownership other than root. By default, all files are owned by root, by group root and have permiss- ion of "-rw-rw-r--". 1.2 You may note, that no execute permissions are set. It is better that way, since it is not possible to run M$ exe- cutables under Linux. 1.3 Since the ownership is root.root, though read access is available on the M$ partiton, but write access is not available. 2. The work around. 2.1 The work-around for this problem is to mount the M$ par- tition under control of a specified "group". Under BSD, all users placed in the group wheel have access to the M$ partitions. This may not be true for systems like RH, SuSE, Debian etc which follow a Sys-V init process. 3. How to do it. 3.1 Checking your system for wheel 3.1.1 In distros like Slackware, which follow the BSD conven- tion, it mau not be necessary to create a seperate group As root do: #cat /etc/group 3.1.2 Note if a group called wheel is existing. Normally, it would read something like this: wheel::10:root (this gid of 10 may change) 3.1.3 If this exists, then all that is needed is to add all users that need m$ partition write access to this. e.g. wheel::10:root,user1,user2,user3 [This needs to be done as root using any editor. In any case, this partition would need mounting through fstab ] 3.1.4 In case, it does not exist, please check which group-id number is free. Normally GID < 100 is used by the system and > 500 is used by users. So, check for a number > 100 but < 500. Usually, 200 or 300 is safe. 3.2 Adding a group. 3.2.1 Do NOT do it manually, unless you know all the files to change. Use the program group add. #groupadd -g 200 msdos 3.2.3 In the above example we added a new group called msdos. The group name can be anything, but msdos gives a clear indication what it is for. 3.2.4 If you do a 'cat /etc/group', you would find something like this at the bottom of the file: msdos:x:200: Edit /etc/group in any editor, as root and add : msdos:x:200:root,user1,user2,user3 3.2.5 This sets your group (msdos) and users who have access to files/partitions used by the group. The only step now is to set up the mounting process for access. 3.3 Tinkering fstab 3.1 Add the following line to fstab. Explanations follow: -------------------------------<snip>---------------------------------- /dev/hda1 /mnt/dos-c vfat defaults,noauto,user,gid=200 2 2 -------------------------------</snip>--------------------------------- 3.1.1 /dev/hda1 ... it is assumed that the partition you want to load is /dev/hda1. In case it is some other, this is to be suitable altered. 3.1.2 /mnt/dos-c ... this is the mount point. This needs to be present on your system before invoking a reboot ... The name /mnt/dos-c is an example. you can create an empty directory with the mkdir command anywhere, with your own preferred name. 3.1.3 vfat ... This is the partition type id. If vfat support is compiled in the kernel, or loaded as a module it will enable long file name support. Other types supported are msdos and umsdos. 3.1.4 defaults ... This sets the default options to rw, suid, dev, exec,auto, nouser, and async. Note, of these, we reset two things with subsequent commands "noauto" and "user". Do 'man mount' for further details. 3.1.5 noauto ... This prevents automatic mounting at boot. It is better to keep it that way since read-write access to a M$ partition should be on a need basis rather than the default. Secondly, if you have updatedb (for locate) set up as a cron process it increases the locatedb size with things from the M$ partition which you may not need. 3.1.6 user ... The nouser default is changed to user since we are giving access to a particular group, which we define immediately thereafter. There are two advantages that we gain here: a) The partition is mountable by an user in the "msdos" group with 'mount /mnt/dos-c' command. b) If you have DIR_COLORS set and would like to have the usual coloured ls listings, this needs to be set. 3.1.7 gid=200 ... This is the msdos group that we created, and the partition access is being regulated for only users listed in the group. 3.1.8 The last "2 2" ... The first 2 is for the "dump" option. This needs a fair amount of explanation. For a short bit of information do 'man fstab'. 3.1.9 The second "2" is for fsck (fs_passno). Being a non-root partition, 2nd pass check is recommended, in case the noauto is changed to auto, so that fsck can check this partition at boot. Do 'man fstab' for other options. ################################################################# 4 Kudos and Brickbats 4.1 This document is released under GNU/ GPL licence. You are free to use and distribute this without any encumberances 4.2 Any kudos and brickbats should be directed at: USM Bish <bish@nde.vsnl.net.in> 13 Oct 2001