LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
LinkBack Search this Thread
Old 02-23-2006, 06:21 AM   #1
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Rep: Reputation: 0
ext. usb HDD mounts read only for non root accounts


Hi!

Firstly, I posted this on a different website's forum... whichever forum solves the problem first will thus be linked to on the other forum! (incentive? I'm joking! )

Ok, I run Debian 3.1r1, 2.6.10 custom kernel, gnome 2.8 (I am pretty sure).

When I plug in an external USB harddrive it will automatically mount,
but only root has permission to write to it. Other users can only read
it. How can I allow for all users to write to it?
It mounts itself to /media/usbdisk.

When I use a usb flash drive or an mp3 player they are also
automatically mounted and ordinary users DO have permission to write to
them.


The HDD is formatted with a reiserfs partition. It displays itself as
/dev/sda1.

I simply want all users to be able to write to the harddrive.
How can this be done? (why isn't it working?!)


Also, if my research is correct, debian uses udev (?) to mount devices
automatically?
I haven't been able to understand what to edit in the config files
(/etc/udev/rule.d/020_permissions.rules?).

I tried adding a line to fstab to see what would happen but it didn't
like the options and so even though the drive was detected (checked
dmesg) it wasn't mounted.
The line I tried was:
#/dev/sda1 /media/usbdisk autofs
rw,user,noexec,noauto,noatime,uid=me 0 0
Have tried permutations of the options, leaving them out until it
finally works (the uid thing is the problem iirc, dmesg listed that).

I have read about creating a script (I don't have enough experience to
know how though) that will probe the device to find it's name/manufacturer and run
something specifically for that device to mount it with relevant options. I don't want to do this but I could with your help if need be.

root has rw access to the drive. When I do an `ls -l` the owner and
group of a file on the hard drive is root whereas for the usb flash
drive it will be the ordinary user under whose session the flash drive
was mounted (though the user probably created the files...).


Thanks in advance!


P.S. When the hdd is attached the following is displayed in dmesg:

...
usb 4-1: USB disconnect, address 3
usb 4-1: new high speed USB device using ehci_hcd and address 4
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
Vendor: ST340014 Model: A Rev: 8.01
Type: Direct-Access ANSI SCSI revision: 00
SCSI device sda: 78165360 512-byte hdwr sectors (40021 MB)
sda: assuming drive cache: write through
SCSI device sda: 78165360 512-byte hdwr sectors (40021 MB)
sda: assuming drive cache: write through
/dev/scsi/host1/bus0/target0/lun0: p1 p2
Attached scsi disk sda at scsi1, channel 0, id 0, lun 0
usb-storage: device scan complete
ReiserFS: sda1: found reiserfs format "3.6" with standard journal
ReiserFS: sda1: using ordered data mode
ReiserFS: sda1: journal params: device sda1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
ReiserFS: sda1: checking transaction log (sda1)
ReiserFS: sda1: Using r5 hash to sort names
 
Old 02-23-2006, 06:45 AM   #2
Sp1t
Member
 
Registered: Jan 2005
Distribution: Suse 10.2
Posts: 68

Rep: Reputation: 15
Can you change permissions from your file browser, eg Konqueror? Set others to 'can view & modify content', tick apply changes to subfolders, click ok...
 
Old 02-23-2006, 06:46 AM   #3
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 11, Sabayon 3.1
Posts: 1,464

Rep: Reputation: 46
firstly udev deals with creating devices nodes in /dev

it doesnt mount them at all.

so you're getting RO file permissions.

can you supply an output of 'cat /etc/fstab'

you've probably got an erronuous entry in there that is being used by hal to mount the device.

when you plug it in please can you supply an output of "cat /etc/mtab"

edit: you may have to change your udev rules so the device file that is created is brw-rw-rw rather than brw-rw----

worth checking out....

Last edited by satinet; 02-23-2006 at 06:48 AM.
 
Old 02-23-2006, 08:41 AM   #4
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Sp1t, thanks for your reply... I use gnome, but i tried it in Konquerer... it says the user and group are root and so I can't change them unless I run it as root... tried that via gnomes utility but it wouldn't load...

satinet, thanks for your message. Okay "hal" cool!

Here is my fstab... I commented out my dodgy line because different devices are mounted as /dev/sda1. When I plug in a fat32 usb key it will mount on /dev/sda1 and so I want different options... hal is supposed to do this without fstab isn't it?

proc /proc proc defaults 0 0
/dev/hda4 / reiserfs notail 0 1
/dev/hda3 none swap sw 0 0
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/hda1 /mnt/ntfs ntfs ro,user,noexec,auto,uid=1000,gid=10000/dev/hda2 /mnt/fat32 vfat rw,user,noexec,auto,uid=me,gid=root 0 0
#/dev/sda1 /media/usbdisk autofs rw,noexec,noauto,uid=1000,noatime 0 0


mtab...
/dev/hda4 / reiserfs rw,notail 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/hda1 /mnt/ntfs ntfs ro,noexec,nosuid,nodev,uid=1000,gid=1000 0 0
/dev/hda2 /mnt/fat32 vfat rw,noexec,nosuid,nodev,uid=1000,gid=0 0 0
usbfs /proc/bus/usb usbfs rw 0 0
tmpfs /dev tmpfs rw,size=10M,mode=0755 0 0
/dev/sda1 /media/usbdisk reiserfs rw,noexec,nosuid,nodev 0 0


It says "rw"... I don't know much, but since Konqueror reported the owner and group to be "root", I guess that the "rw" is for users in "root".


When I enable the last commented line in fstab (which I added) and attach the hdd, dmesg shows this and the device doesn't mount:
usb 4-1: USB disconnect, address 11
usb 4-1: new high speed USB device using ehci_hcd and address 12
scsi9 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 12
usb-storage: waiting for device to settle before scanning
Vendor: ST340014 Model: A Rev: 8.01
Type: Direct-Access ANSI SCSI revision: 00
SCSI device sda: 78165360 512-byte hdwr sectors (40021 MB)
sda: assuming drive cache: write through
SCSI device sda: 78165360 512-byte hdwr sectors (40021 MB)
sda: assuming drive cache: write through
/dev/scsi/host9/bus0/target0/lun0: p1 p2
Attached scsi disk sda at scsi9, channel 0, id 0, lun 0
usb-storage: device scan complete

As you can see the filesystem stuff is left out.
It isn't listed as mounted in mtab


Quote:
edit: you may have to change your udev rules so the device file that is created is brw-rw-rw rather than brw-rw----
Awesome, will look into it but would still appreciate if anyone can give me a little push in the right direction.
 
Old 02-23-2006, 09:20 AM   #5
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 11, Sabayon 3.1
Posts: 1,464

Rep: Reputation: 46
well, hal is pretty imature. which version are you using?

you could also try adding your user into the 'disk' group - go to /etc/group.

looks like hald is treating the device different than it does a solid state device.

try the /etc/group think 1st.

then get a new version of hald.

last edit udev rules. in /etc/udev i think.
 
Old 02-23-2006, 07:47 PM   #6
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for that help Satinet. Later on I will try altering the hal rules (the other things didn't work... Hal is the latest deb package install.). I will post back with the results, thanks for everything!
 
Old 02-24-2006, 08:00 AM   #7
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Ok, I have some info.

Gnome has something called "gnome-user-manager" which does some stuff with the automounting.
Hal's documentation can be found here
Hal's configuration files are located in /usr/share/hal/fdi/
The main Hal configuration file is 90defaultpolicy
A site about writing udev rules is located here

Ok, so that is some stuff I have learnt, and seems to be all that is relevant to this discussion.

I noticed something interesting today.
When I plug in my harddrive it is mounted differently to the flashdrive. The following output from mtab shows the hdd (sda1) and the flash drive (sdb).
uid/gid=1000 is the user I want to give ownership/group permission to the harddrive!

/dev/sda1 /media/usbdisk reiserfs rw,noexec,nosuid,nodev 0 0
/dev/sdb /media/usbdisk-1 vfat rw,noexec,nosuid,nodev,quiet,uid=1000,gid=1000,umask=077 0 0

So now I need to work out how to do that... I will examine the crazy hal rules file and look for something to go on.
If anyone knows how to help then let me know. Especially since the hal config file is meaningless to me due to it's utter randomness.

Thanks for your post Satinet!

I'll keep looking at this and post back with some more info.
 
Old 02-24-2006, 12:33 PM   #8
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 11, Sabayon 3.1
Posts: 1,464

Rep: Reputation: 46
i was thinking abotu this today.

what's your version of udev??

i think i upgraded mine to current before i installed FRG. or maybe i didn't.

lol.
 
Old 02-24-2006, 10:58 PM   #9
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Hey!

I plugged in a fat32 formatted usb hdd today and it mounted rw for all users as it should...

So it looks like reiserfs is the problem, maybe no rule exists for it for hal or the rule is different.

I'll try formatting the drive as ext3 and see what happens... if that doesn't work I'll try looking at the rules.
 
Old 02-24-2006, 11:01 PM   #10
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
oh yeh... udev is .0.57 or thereabouts while in testing there is .0.86 or so. So I could always update it.
Problem is it requires a kernel greater than 2.6.12... the ati proprietary drivers work fine for me on 2.6.10 though! If I can get this harddrive working I am going to install ubuntu on it (i'll try anyway...) and mess around with getting a working configuration for 2.6.15 with the ati drivers and all the other things like wlan that cause problems.

Thanks for the suggestion, I might just give it a go. (my pc is a laptop so I don't have the freedom to put drives in and mess around with various configurations so when I get something I like I just have to stick with it )
 
Old 02-25-2006, 01:02 AM   #11
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
I discovered that reiserfs doesn't support options like uid and guid... ooops. Nevermind

I managed to create a udev rule that detects when the usb hdd is attached and will create a static device file for it no matter if it is /dev/sda1 or /dev/sdb1 etc.
So I have a static link like that.
I've tried mucking around with setting it's mode to "0666" but that is just the mode of the device file and not of the mounted partition.

The files I added rules to were:
/etc/udev/udev.rules
/etc/udev/devfs.rules
/etc/udev/permissions.rules
/etc/udev/hal.rules

Use the guide in the link I posted above to write udev rules (anyone who is interested that is).

Hal won't automatically mount the drive though I have to do that manually.
I can mount it perfectly (including using the static device file) but only root has write access. This is where it gets interesting.
If root creates a file. If I use chgrp and chgrp to set the file to the user I want, and if I use chown to give everyone rw access, no one else other than root can still write to it. With `chown 666 file` only root can still write to the file!

Now, perhaps reiserfs is not suitable for use in an external usb hdd? I am reasonably sure that people would use it though. Maybe someone can enlighten me?

I am going to restart my computer to see if hal will automount the drive (I just want to see that work regardless of write access).
 
Old 02-25-2006, 01:30 AM   #12
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Ok, I have summarised the problem here:

I just realised that I do have write access to the drive - but I can't create new files, nor delete existing files (as a non-root user <-edit).

I can create a file as root, then `chmod 777` it, I can then as an ordinary user modify it, but I can't delete it.

I can modify an existing file, but not create a new one. Does anyone know why?

Thanks in advance!

edit again: the filesystem is reiserfs and I am speaking of the usb drive

Last edited by logname; 02-25-2006 at 01:31 AM.
 
Old 02-25-2006, 03:43 AM   #13
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
PROBLEM RESOLVED (I don't know how to change the title...lol)

Had to change to group and owner of the folder where I mounted the device to user...
I think just the group matters, not too sure.
 
Old 02-27-2006, 03:32 PM   #14
Sp1t
Member
 
Registered: Jan 2005
Distribution: Suse 10.2
Posts: 68

Rep: Reputation: 15
Which is what I said...
 
Old 02-27-2006, 04:17 PM   #15
logname
LQ Newbie
 
Registered: Feb 2006
Posts: 14

Original Poster
Rep: Reputation: 0
lol! Yeah it was! Thanks sp1t!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
9.3(Here's how to Read Windows NTFS files on ext USB drive as user 1kyle Suse/Novell 0 09-01-2005 03:59 AM
ext hdd mounting read/write issue Jestrik Linux - Hardware 1 06-12-2004 08:46 AM
Lexar USB Jump drive mounts read only qaball Linux - Hardware 7 02-06-2004 07:22 AM
Unable to edit fstab... problems with ext. usb hdd removal gardyloo Linux - Newbie 1 12-27-2003 06:35 PM
Toshiba boot problems - USB ext HDD - new install wtriver Linux - Newbie 5 11-02-2003 04:38 PM


All times are GMT -5. The time now is 05:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration