ext3 partition on external USB hard drive mounted, but only root access allowed
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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)
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.