Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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. –  boscho Aug 20 '13 at 21:04
add comment

1 Answer 1

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 \\127.0.0.1\share etc. It will be messy and a bit complex but will work OK.

share|improve this answer
1  
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! –  boscho Aug 21 '13 at 20:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.