Re: Permissions for a FAT partition
Here is info that I got when I tried to solve the same problem.
(Credits go to them.)
Yuhanes
Only root can write to mounted a DOS drive
Question:
Squash at 7 tomorrow is good.
If you have time, I have a Linux question...
I have my windows drives mounted and the only
way I can write to them is if I am root. So
I tried to remedy this by changing the group
they belong to and adding myself to that group.
I created a group called windrive and assigned
that as the group ID on the drive. When I do
ls -l, I get this:
kturner@mems:/mnt$ ls -l
total 24
drwxr-xr-x 18 root windrive 8192 Dec 31 1969 c
drwxr-xr-x 22 root windrive 16384 Dec 31 1969 data
Which as I understand it, means root can read, write and
execute, but the group windrive can only read and exeute. So
I logged in as root and tried
chmod g+w ./c
which I thought should give the group permission to write on c. It
does not give errors, but it also doesn't change the permissions.
When I do ls -l again I still get the same permisssions
mems:/mnt# ls -l
total 24
drwxr-xr-x 18 root windrive 8192 Dec 31 1969 c
drwxr-xr-x 22 root windrive 16384 Dec 31 1969 data
Any suggestions?
-Kevin
Answer:
Yeah, this is a common problem. It is related to the fact that FAT
filesystems really don't have permissions.
The way that linux handles this is that when you mount a FAT drive, all
the files are given the _same_ file permissions at mount time.
Furthermore, once mounted, these permissions can't be modified.
The default permissions that mount will use for FAT partitions is
"rwxr-xr-x". To change this, you can add an option "umask=" in the fstab
file. For example, on my computer, I use:
/dev/hda1 /mnt/c vfat defaults,umask=0000 0 0
The argument to umask is and octal number. To understand what this number
means, you have to understand how file permissions actually work in unix.
The way file permissions are stored on the disk is as a 9-bit binary
number. The best way to show this is with examples. File permission are
commonly represented in three ways:
rwxr-xr-x - human readable
111101101 - binary number
7 5 5 - 3 octal numbers
The last one is the most important. If you read the manpage for chmod, you
will notice that you can specify the desired permissions using and octal
number. Examples:
gsteele@atlas:~$ chmod 0755 foo
gsteele@atlas:~$ ls -l foo
-rwxr-xr-x 1 gsteele gsteele 1123166 Mar 27 11:42 foo*
gsteele@atlas:~$ chmod 0766 foo
gsteele@atlas:~$ ls -l foo
-rwxrw-rw- 1 gsteele gsteele 1123166 Mar 27 11:42 foo*
gsteele@atlas:~$ chmod 0777 foo
gsteele@atlas:~$ ls -l foo
-rwxrwxrwx 1 gsteele gsteele 1123166 Mar 27 11:42 foo*
(Note: the first number is related to "special file permissions". You
should always leave this number as 0. You can read about these here:
http://www.lns.cornell.edu/public/COMP/info/fileutils/fileutils_3.html#SEC4)
Now, umask is like the binary NOT of the file permissions you want. For
example:
rwxr-xr-x - desired file permissions
111101101 - binary file permissions
000010010 - umask
0 2 2 - octal umask
So, for example, in my fstab file, I use umask=0000, so that the
permissions on my dos drive are rwxrwxrwx. If you wanted the permissions
on the dos drive to be rwxrwxr-x, you would set umask=0002.
You can also change the group and the owner of the FAT partition files
using the options uid=value,gid=value in the fstab file, where the values
are the user id number and group id number.
The uid numbers for users are listed in the file /etc/passwd, and the gid
numbers are listed in the file /etc/group:
in /etc/passwd:
gsteele:x:1001:1001:Gary Steele,13-2033,3-4810,:/home/gsteele:/bin/bash
| |
uid default gid for user gsteele
in /etc/group:
gsteele:x:1001:
|
gid for group gsteele
This should sort out any problems.
Cheers,
Gary.
Rich schrieb:
Howdy all,
I want to change the default permissions of files in a FAT partition.
I understand that FAT file systems have no concept of permission or
ownership. When I mount the partition ownership is set to root and
permissions are set to 755. This means that only root can write to it.
I'd like it to be writable by ordinary users.
I've tried fiddling the permissions of the mount point, and options to
the mount command, but have had no luck. Anyone know how to make my
FAT partition writable?
thanks,
Rich
Reply to: