LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File permissions on mounted FAT drive (https://www.linuxquestions.org/questions/linux-newbie-8/file-permissions-on-mounted-fat-drive-682168/)

dp_miller 11-09-2008 11:46 AM

File permissions on mounted FAT drive
 
Hi, I'm running Debian on a Linksys NSLU2. All working great except I can't seem to get write permissions for anyone other than root on my second USB drive, which is FAT. The hardware is mounting fine and root can read and write.

The entry in fstab is this:
/dev/sdb1 /media/usb500 auto rw,users,auto 0 0

When the device is NOT mounted, the perms are as follows:
drwxrwxrwx 2 darren root 4096 Nov 5 23:32 usb500

As soon as it's mounted, they change to this:
drwxr-xr-x 11 root root 32768 Jan 1 1970 usb500

I think I understand why the perms defaut back to this (system is making assumptions in the absence of file data on the FAT drive?), but I can't figure out how to get those all-important w's back.

Attempting to chmod after mounting has no effect on the usb500 directory and throws errors on everything inside.

I've tried changing auto to vfat in fstab and that didn't help. I've also attempted to mount manually using -0 gid=darren, and that almost works in that the owner remains darren, but it still doesn't give me the write perms I need.

If anyone can help me I'd be very grateful.

cheers
Darren

paulsm4 11-09-2008 12:11 PM

Hi -

Look here:
http://ubuntuforums.org/showthread.php?t=402813

Quote:

You can't change the ownership of files or folders on a FAT drive because FAT doesn't store ownership attributes. The ownership of everything on the drive is emulated, and is set by the way it is mounted. So you need to fix up the way the drive gets mounted when it is first plugged in.

A quick experiment shows that the drive gets automounted as being owned by the owner of the desktop when it's plugged in. I can't try to see what happens when no-one is logged in without losing this post I'm halfway through. Anyway, I think you need to unmount the drive and re-mount it by hand. Like this (in my tests, my USB stick was /dev/sdc1 - use the command mount to see where it's currently mounted and what device it is:
Quote:

steve@StevesPC:~$ mount
----- all my other mount points deldted for clarity -------
/dev/sdc1 on /media/UDISK 2.0 type vfat (rw,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,iocharset=utf
steve@StevesPC:~$ sudo umount /dev/sdc1
steve@StevesPC:~$ sudo mount -o umask=0 /dev/sdc1 /media/UDISK\ 2.0/

Note that if the media is writable, then you should be able to set write permissions. You should also be able to set write permissions for whatever user you prefer.

dp_miller 11-09-2008 01:03 PM

No that didn't get it. Tried a umount followed by a manual mount with -o umask=0. it mounted ok but the write permission is still missing.

paulsm4 11-09-2008 03:27 PM

Hi -

You're either missing something in the "mount" command, or Debian doesn't recognize it as a "read-write" device. A couple of suggestions:

1. Forget about fstab and focus on "mount" (at least for debugging)

2. Focus on "vfat" filesystem type (at least for debugging)

3. Check output from "lsusb" and /proc/usb/NNN
http://linux.die.net/man/8/lsusb

4. Check for errors/diagnostic info in the system logs, e.g.
dmesg | less
less /var/log/syslog
etc.

Here are another couple of links that might help:
http://ubuntuforums.org/showthread.php?t=803881
http://www.mepis.org/node/2105

i92guboj 11-09-2008 05:24 PM

The vfat umask option should really work. As someone said above, vfat doesn't store the linux permissions info because it simply lacks the support to do so.

Mount it and double check the output of "mount" without arguments to see that all the options have been applied correctly. We assume that the drive has not some kind of physical write protection mechanism, that can be easily checked using root and trying a write.

dp_miller 11-10-2008 02:20 AM

Thanks for all your suggestions. I've got to get to work now but I'll try again this evening.
(in the meantime I'm seriously considering a re-format to ext3 and am copying data off in preparation!)

salter 11-10-2008 05:54 AM

FAT file systems do not have UNIX-style permissions. If your device is mounted correctly in a way that every user has read-write access, then any user will be able to read-write.

The fact that only root can write to the device means that your way of mounting is faulty.

Check the /etc/fstab file to see the current settings.

If you do mount by hand as root, then explicitly give an option to give write permission to anyone. Otherwise only root can write.

sundialsvcs 11-10-2008 09:03 AM

It's worth mentioning that FAT really isn't suitable for Windows anymore, either!

Why not re-format the drive to a more suitable format... one that does recognize permissions. It may take a little digging, but both Windows and Linux support the idea of "installable file systems" and they both support quite a few.

Realistically, most shared-storage these days is network attached anyway. They are specialized devices that consist of storage controllers, network interfaces and lots of disk-drives. And they're cheap. Apple sells one (and it looks "way cool!") but they didn't really plow any new ground to do it.

dp_miller 11-10-2008 03:54 PM

Well, that one is going to have to remain a mystery. I've been through every link posted, every combination of mount commands I could think of, and I still could only get write permissions as root.

So I now have a shiny new ext3 file system that's sharing everything with correct permissions via Samba.

I could go off Windows you know...

thanks for the help anyway.


All times are GMT -5. The time now is 12:23 PM.