Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In all likelihood this is a repeat question, but I seem to be currently experiencing difficulties forming a search query to locate an answer.

I have a vfat partition mounted to /data containing all of my media, i.e. /data/books, /data/documents, /data/downloads, /data/websites, etc. The websites sub-directory is (soft) sym-linked to from /var/www such that my Apache2 installation uses the directory as its default DocumentRoot. My fstab entry is currently set to mount /data using my user/user-group (uid=1000,gid=1000) such that I can freely make changes to any file without further hassle.

However, I need the /data/websites directory to be mounted with the www-data user (uid=33,gid=33) such that Apache and my web-documents may create, modify, and delete files in the directory. My user is a member of the www-data group (gid=33) such that I may also make changes to the files in the directory.

chgrp and chown are out of the question as they simply have no effect on a mounted vfat partition. How can I mount /data/websites with a different owner/group (uid=33,gid=33) while leaving the rest of the /data mount owned by my user (uid=1000,gid=1000)?

share|improve this question
Is /data and it's subdirectories all one partition, or are /data/books, /data/documents, etc different partitions? – ernie Aug 20 '13 at 20:58
Good clarifying question! /data corresponds to a singular partition, /dev/sda5 on my system. All of its sub-directories reside directly upon the partition. – bosco Aug 20 '13 at 21:04
up vote 2 down vote accepted

Since FAT does not support notion of filesystem permissions at all, let alone UNIX compatible ones, Linux mounts each file in the filesystem with the same owner and group-owner, as specified in the mount command or fstab.

A couple options:

  • Don't use a vfat partition, use ext2 or ext3 (if this is an Android phone and it's rooted with Cyanogenmod, you might be able to format your card ext2 or ext3 if you look around for a howto)

  • This is convoluted but should work. Install samba if it's not already active - create shares according to the folders and permissions you wish to expose, and then mount them using mount -t cifs \\\share etc. It will be messy and a bit complex but will work OK.

share|improve this answer
I'll second the samba solution. From your comment, I'm guessing you're using /dev/sda5 as common storage on a multi-boot system, so setting up samba shares, and then "re-mounting" locally to change permissions seems like the best workaround. – ernie Aug 20 '13 at 21:27
Spot on! Took me a spell to configure everything correctly, but it works like a charm. And you're right on target @ernie - /dev/sda5 is indeed my common storage for a multiboot environment. Many thanks! – bosco Aug 21 '13 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .