Accessing partitions as user
Dale Farnsworth
dale at farnsworth.org
Sat Jul 7 04:09:43 MST 2007
Harold wrote:
> I had tried doing that but it will not let me either chmod or chown
You asked about ext3, and ext3 will allow you to chmod or chown the
files on disk. However, the examples you give below are for a vfat
filesystem, where you *cannot* use chmod/chown.
> Here are some of the responses I have been getting when trying this
> project. I will use the hda5 which is a FAT32 formatted partition on my
> primary hard drive. My intent for this partition was to provide a 2GB
> space to transfer Windoze files to the Linux side.
>
> I mount this drive on bootup using this command:
>
> /dev/hda5 /mnt/hda5 vfat rw,auto,users 0 0
That looks like a line from /etc/fstab, not a command.
> This is the listing I get from the /mnt directory:
>
> [root at localhost mnt]# ls -alb
> total 27
> drwxr-xr-x 4 root root 4096 Mar 28 15:18 .
> drwxr-xr-x 24 root root 4096 Jul 6 11:51 ..
> drwxr-xr-x 2 root root 4096 Mar 27 12:12 floppy
> drwxr-xr-x 4 root root 3072 Dec 31 1969 hda5
>
> When I try to chmod I get this:
>
> [root at localhost mnt]# chown koder:koder /mnt/hda5
> chown: changing ownership of `/mnt/hda5': Operation not permitted
> [root at localhost mnt]# chmod -c 4775 hda5
> chmod: changing permissions of `hda5': Operation not permitted
>
> And chown gives this:
>
> [root at localhost mnt]# chown koder:koder /mnt/hda5
> chown: changing ownership of `/mnt/hda5': Operation not permitted
The vfat filesystem does not support individual file owners or
permissions. This is a limitation of the filesystem structure;
it's an early windows filesystem from when windows didn't support
multiple users.
Instead of being able to change the ownership or permissions of
individual files, you must specify them for the entire filesystem
at mount time. You have two options:
1) If you want to allow *any* user to read and write all files,
add the umask=0000 option to the line in /etc/fstab, like:
/dev/hda5 /mnt/hda5 vfat rw,auto,users,umask=0000 0 0
2) If you want to allow *one* user to read and write all files,
add the uid=USER option to the line in /etc/fstab. For example,
to give the user "harold" full access to the files, use:
/dev/hda5 /mnt/hda5 vfat rw,auto,users,uid=harold 0 0
Note that the umask= and uid= options are not usable with ext3
systems, since ext3 supports the normal linux (UNIX) filesystem
ownership and permissions.
> If I use fstab mount the USB drives I get a 'failed ' on the list that
> displays while booting.
> I get about the same thing if I do not specify vfat for hda5. They zip
> by fast enough I can't guarantee 'same'.
Whether they are USB or IDE doesn't matter, but the ext3 vs vfat
difference does matter.
> Matt Graham suggested that there may be an issue with passwords in
> relation to SELinux. The messages almost sound like that, but I know
> nothing about SELinux and how it interacts with the system.
This has nothing to do with SELinux.
> Should I fdisk the USB disks and format vfat?
There are pros and cons either way, so it depends on what you want
to accomplish. I would go with ext3 for linux-only use. If the
filesystems are going to be used by both linux and windows, go with
vfat.
-Dale
More information about the PLUG-discuss
mailing list