LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   ext3 partition on external USB hard drive mounted, but only root access allowed (http://www.linuxquestions.org/questions/linux-hardware-18/ext3-partition-on-external-usb-hard-drive-mounted-but-only-root-access-allowed-415876/)

leontini 02-15-2006 05:53 PM

ext3 partition on external USB hard drive mounted, but only root access allowed
 
Hi all,

I apologise if I am repeating questions already asked, but after trawling other posts I can't quite get a straight answer to this question.

My problem is as follows.

I have a 200GB Seagate external USB hard drive, that I plan to use as a backup disk. I want to keep two partitions on this disk, one formatted as VFAT (where I can keep zip files that I could recover under windows), and a second formatted as ext3 (so that I can use something like rsync to keep an exact copy of my data that can be updated incrementally).

I have managed to create and format the two partitions using fdisk. I have created the ext3 file system on the ext3 partition using mke2fs.

As I am running Fedora Core 4, HAL detects when I hook up the drive, and now creates two directories in /media; one called /SEAGATE, where it mounts the VFAT partition (/dev/sda1), and a second, /usbdisk, where it mounts the ext3 partition (/dev/sda2).

That is great, except that only the VFAT partition is mounted to allow normal users write permission. The ext3 partition is owned by root, and normal users are only given read and execute permission. What I would like to happen is that the ext3 partition would be assigned to the owner and group corresponding to the current user, and that user given full read, write and execute permission.

I have considered playing with the fstab, but the entries for this disk are automatically generated by fstab-sync, and so I expect any modifications I make will be lost during the next bootup.

So, is this a problem with the way HAL detects my second partition? Should I add a manual entry to the fstab, and if I do, will this mess with the way HAL detects other USB devices, especially if I want to use them at the same time as the hard drive?

I am running FC4 with the standard kernel.

Thanks in advance,

J.W. 02-15-2006 07:28 PM

Have you tried manually changing the permissions on /usbdisk? As root, just
Code:

chmod 777 /usbdisk
For more info on chmod, see the man pages, but the "777" corresponds to the "rwx" settings for each of the 3 permission levels. r = 4, w = 2, and x = 1 and thus 777 equates to rwxrwxrwx. (For illustration purposes, 744 would correspond to rwxr--r--, 666 would correspond to rw-rw-rw-, and so forth)

jschiwal 02-15-2006 07:31 PM

You can change the ownership and/or group ownership on the ext3 partition using the chown command. You can also use the chmod command. If all users are members of "users" for example, you can "chgrp users /USBDISK" and give full permissions to the "users" group. You can also have distinct permissions on the directories and files inside. The fat32 partition can only have permissions set globally when it is mounted.

I think that the changes you made to the /USBDISK partition will be retained provided that it was mounted on the mount point before you made them.

leontini 02-15-2006 10:13 PM

Thanks guys,

Yes, manually changing the ownership and group allow me to write to the drive. While that is a solution, I thought that it should be possible to change the permissions that HAL sets these partitions when they are mounted. It seems to default mount everything (including my VFAT partition) with root ownership and group (which is fine), and sets the permissions to 755 (which is bad). I guess this is not an issue with the VFAT partition due to the fact that it does not recognise linux permissions anyway.

So, is thee a way to modify the behaviour of HAL to get it to mount my ext3 partition with permissions of 777 automatically? Any guidance here would be appreciated.

Thanks,

EDIT:
Sorry people, if I leave something written on the disk that was written under the modified group and ownership that I set manually, HAL seems to automatically retain those permissions when the drive is remounted at a later time. So, it seems that the problem is resolved. Thanks for all your efforts.

jschiwal 02-17-2006 01:54 AM

I think that you may be confusing the terms HAL and udev, unless your system is different. Although they are related, and
Take a look at the *.rules files in: /etc/udev/rules.d/

It may be better to make yourself a member of the group that the device uses rather than editing the file.

For example, suppose you plug in a usb cdrom burner. Running k3b, it doesn't show up, while it does for the root user. After making yourself a member of the "cdrom" group, it should show up.

This isn't a complete explanation. I still have a lot to learn about udev. I just tried a little experiment while typing this message. I plugged in a usb key drive. It was auto-mounted under /media/usbdisk. The /media/usbdisk was mounted with a root owner and root group owner with permissions of 'drwxrwxrwx'. Cd'ing in, the long listing indicates that I am the owner, and my default group is the group owner. I switched to vt/2 and logged in as root; then switched to vt/3 and logged in as a different normal user. For all three users, the contents of the key-drive had the user/group identical to that of the user accessing the drive. Yes, I mean simultaneously.


All times are GMT -5. The time now is 12:37 AM.