setting permissions for a mounted fat32 partition

Posted on 2006-03-30
Last Modified: 2012-05-05
I have a dual boot system (SUSE 10 / WIN XP).  My hard disk has a shared fat32 partition.  My problem is, the fat partition is mounted in SUSE under /windows/d but I can't seem to write to it unless I am operating as root.  

I first tried changing my fstab file to include this line:
/dev/hda5           /windows/d              vfat           users,owner,rw,umask=000 0 0

That didn't work.  

Then I got very confused when I found there was also a file called mtab which had an entry for windows/d, so I changed that line to be exactly the same as the one in fstab.  Why is there an fstab and an mtab?  What's the difference?  Which one is used? Which takes precedence?

Then I opened a terminal, changed to su and used chmod thus:
chmod /windows/d 777 -Rv
The command executed without error and said it changed the permissions, however I still could not write to the fat partition unless logged in as root.  

I checked the permissions on windows/d in Konqueror, and they had not been changed - only root had full access.  So I opened Konqueror as root and changed to permissions  to give full access to everyone, applied to all subdirectories and files.  Konqueror accepted this command, appeared to apply the permissions, but as soon as I closed the 'properties' window and opened it again the changes were lost - once again only root has full access.

All I want is to have write access to my fat32 permission when not logged in as root.  Any ideas?  Or should I just give up on linux and go back to windows?

Question by:basicinstinct
    LVL 25

    Accepted Solution

    You need to change the attributes in the fstab file. Change the line to
    /dev/hda5    /windows/d   vfat     umask=000,users,owner,rw,uid=<the user id you want to be able to write as>,gid=<the group id you want to write with> 0 0

    FAT32 doesn't have permission capability so you trick it with providing a uid and gid at mount
    LVL 23

    Author Comment

    Hi Cyclops
    thanks for your suggestion.  My fstab and mtab now contain the line:
    /dev/hda5 /windows/d  vfat  umask=000,users,owner,rw,uid=1000,gid=100 0 0

    I'm afraid that hasn't seemed to fix it, I still can't write to the fat partition.

    I got the uid and gid by typing 'id' in the terminal.  The output was:
    uid=1000(rick) gid=100(users) groups=16(dialout),33(video),100(users)

    I don't have to reboot do I?  I tried closing my session and then logging back in.  I also changed to su and entered 'umount -a' followed by 'mount -a'.

    I'm not sure if it makes any difference, but I am not accessing the linux machine directly, I am connecting over a LAN from a winXP laptop using VNC Viewer.  I doubt this makes any difference but thought I should mention.

    Any further ideas appreciated.
    LVL 10

    Expert Comment

    Hi, are you sure that it is fat32 partition? Can you run
    # fdisk -l  and post output here?

    tun :
    # mount

    to see how are partition mounted.

    if your partition is mounted os ro then simply run:

    #mount -o remount,rw  /windows/d

    this will remount partition to rw.

    > chmod /windows/d 777 -Rv <== this are only permition to folders.

    good luck

    LVL 23

    Author Comment

    hi lubo - thanks for the comments
    here is the output from 'fdisk -l' and 'mount'

    #fdisk -l
    Disk /dev/hda: 80.0 GB, 80060424192 bytes
    255 heads, 63 sectors/track, 9733 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1   *          72        1019     7614778+   7  HPFS/NTFS
    /dev/hda2            1020        9580    68766232+   f  W95 Ext'd (LBA)
    /dev/hda3               1          71      570276   83  Linux
    /dev/hda4            9581        9733     1228972+  82  Linux swap / Solaris
    /dev/hda5            1020        3569    20482843+   b  W95 FAT32
    /dev/hda6            3570        4595     8241313+  83  Linux
    /dev/hda7            4596        6125    12289693+  83  Linux
    /dev/hda8            6126        9580    27752256   83  Linux

    Partition table entries are not in disk order

    Disk /dev/hdc: 20.0 GB, 20020396032 bytes
    255 heads, 63 sectors/track, 2434 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hdc1   *           1        2434    19551073+  42  SFS

    Disk /dev/hdd: 20.0 GB, 20020396032 bytes
    255 heads, 63 sectors/track, 2434 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
    /dev/hdd1               2         638     5116702+   f  W95 Ext'd (LBA)
    /dev/hdd2             639        2434    14426338+   c  W95 FAT32 (LBA)
    /dev/hdd5               2         638     5116671    b  W95 FAT32

    /dev/hda6 on / type ext3 (rw,acl,user_xattr)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    tmpfs on /dev/shm type tmpfs (rw)
    devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
    /dev/hda3 on /boot type ext3 (rw,acl,user_xattr)
    /dev/hda7 on /home type ext3 (rw,acl,user_xattr)
    /dev/hda8 on /usr type ext3 (rw,acl,user_xattr)
    /dev/hda1 on /windows/c type ntfs (rw)
    /dev/hda5 on /windows/d type vfat (umask=000,users,owner,rw,uid=1000,gid=100)
    usbfs on /proc/bus/usb type usbfs (rw)
    /dev/fd0 on /media/floppy type subfs (rw,nosuid,nodev,noatime,fs=floppyfss,procuid)
    /dev/hdc1 on /mnt/storeii type ntfs (rw)
    /dev/hdd2 on /mnt/oldc type vfat (rw)
    /dev/hdb on /media/dvdrecorder type subfs (ro,nosuid,nodev,fs=cdfss,procuid,iocharset=utf8)

    LVL 10

    Expert Comment

    Correct me if I'm wrong by this /dev/hda5 on /windows/d type vfat (umask=000,users,owner,rw,uid=1000,gid=100) is needed to setup partiton with NTFS filesystem.

    You have already mounted FAT32 on /dev/hdd2  /mnt/oldc type vfat (rw). Check you /etc/fstab and adjust the line for /dev/hda5 according /dev/hdd2 and you should be fine.

    LVL 10

    Expert Comment

    did you try this: #mount -o remount,rw  /windows/d

    try it and then run #mount and paste it here
    LVL 43

    Assisted Solution

    > I don't have to reboot do I?
    It seemed to be missed.
    Yes. Either You have to remount the partition or restart the machine.
    umount /windows/d
    mount /windows/d
    LVL 23

    Author Comment

    Well surprise surprise - I rebooted my computer and it works now.  It's hard for me to know what fixed it in particuler, and I'm grateful to all you experts who took the time to help.  

    I think the suggestion from Cyclops to set the gid and uid was a necessary part of the fix, and raven told me that I actually did have to reboot the machine (by the way, umount /windows/d followed by mount /windows/d did not work).  So I think I will split the points between those two.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
    If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now