I have a Fat32 external hard drive plugged into my server at home and since upgrading to Ubuntu 10.04 (from 8.10 - it was a bug jump!) I've been having permissions trouble with it.

It used to be mounted as root automatically and I think the permissions were pretty much 'ignored'. Since the upgrade, it is being mounted with the group and owner being my user. Obviously, I need access as my user and this is no problem still. However, I am also running a PHP script (via apache) that serves certain files to authenticated users. This is now no longer working.

If I run PHP as my user there is no problem (obviously). However, when running under www-data it cannot access the drive so my script is now failing.

The permissions on the drive look like this at the moment:

drwx------ 1 adamnfish adamnfish
-rwxrwxrwx 1 adamnfish adamnfish

for folders and files respectively.

It's very clear what the problem is (only adamnfish can access the drive!) but I have no idea how to fix the problem. I've tried mounting the drive every which way and even using GUI tools to try and set the bitmask properly!

The hard drive is always plugged in, but sometimes I kick its power cord while tidying up (so the solution needs to be resilient to plugging / unplugging the drive) and I reboot the machine from time to time (so ideally it'll be an fstab entry or something so I don't need to manually unmount and remount with the correct permissions every time).

Thanks in advance, I know this will be obvious to a lot of people but I've been pulling my hair out!


Please read this Ubuntu wiki entry, especially the part about fstab and its options: https://help.ubuntu.com/community/AutomaticallyMountPartitions

The important thing to understand is that you actually specify the permissions on the mount location, for example /mnt, and the device that will be mounted to that mount location will have those permissions. So just add an entry to fstab that mounts your fat32 disk to /mnt for example end set the correct permissions on that folder.

There is also a handy tool for managing storage devices that you might like, called pysdm: http://pysdm.sourceforge.net/

  • I found pysdm, but I couldn't get it to work properly for me (and I'd rather learn to do it properly!). The mount location hint was exactly what I needed and that link will be a great help, thanks! – adamnfish Sep 1 '10 at 22:16
  • 1
    I'd also recommend against using pysdm; I've not used it personally, but I've seen other inexperienced users put their systems into a state where it would fail to boot successfully because of something done via pysdm. Learning how to configure fstab correctly is not that hard. – Steve Beattie Nov 5 '10 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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