LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 10-23-2009, 02:05 AM   #1
DaveQB
Member
 
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Mandriva 2009.1, Debian Etch
Posts: 344
Thanked: 7
Removable media permissions on CentOS


[Log in to get rid of this advertisement]
Hi all,

I followed this great primer to udev:
http://reactivated.net/writing_udev_rules.html

So my aim is to control perms on devices mounted.

2 Issues.

1.
Code:
udevinfo -a -p /sys/block/sdb

  looking at device '/block/sdb':
    KERNEL=="sdb"
    SUBSYSTEM=="block"
    SYSFS{stat}=="      26       11      296      322        0        0        0        0        0      316      322"
    SYSFS{size}=="31588352"
    SYSFS{removable}=="1"
    SYSFS{range}=="16"
    SYSFS{dev}=="8:16"

  looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/host7/target7:0:0/7:0:0:0':
    ID=="7:0:0:0"
    BUS=="scsi"
    DRIVER=="sd"
    SYSFS{ioerr_cnt}=="0x1"
    SYSFS{iodone_cnt}=="0x10a7"
    SYSFS{iorequest_cnt}=="0x10a7"
    SYSFS{iocounterbits}=="32"
    SYSFS{timeout}=="60"
    SYSFS{state}=="running"
    SYSFS{rev}=="0.00"
    SYSFS{model}=="Voyager Mini    "
    SYSFS{vendor}=="Corsair "
    SYSFS{scsi_level}=="3"
    SYSFS{type}=="0"
    SYSFS{queue_type}=="none"
    SYSFS{queue_depth}=="1"
    SYSFS{device_blocked}=="0"
    SYSFS{max_sectors}=="240"

  looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/host7/target7:0:0':
    ID=="target7:0:0"
    BUS==""
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0/host7':
    ID=="host7"
    BUS==""
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4:1.0':
    ID=="1-4:1.0"
    BUS=="usb"
    DRIVER=="usb-storage"
    SYSFS{modalias}=="usb:v1B1Cp0B31d0100dc00dsc00dp00ic08isc06ip50"
    SYSFS{bInterfaceProtocol}=="50"
    SYSFS{bInterfaceSubClass}=="06"
    SYSFS{bInterfaceClass}=="08"
    SYSFS{bNumEndpoints}=="03"
    SYSFS{bAlternateSetting}==" 0"
    SYSFS{bInterfaceNumber}=="00"

So my understanding is I could use DRIVERS=="usb-storage" its its in a parent device.

so I created this:

SUBSYSTEM=="block", DRIVERS=="usb-storage", MODE="0600"

But then I get:

Code:
udevtest  /sys/block/sdb
add_to_rules: unknown key 'DRIVERS'
main: unable to open '/sys/block/sdb'

If I change it to DRIVER is doesn't complain, but of course, doesn't work.


2. The device is being created with these perms:
Code:
ll /dev/sdb1
brw-r----- 1 root disk 8, 17 Oct 23 14:38 /dev/sdb1
Code:
mount |grep sdb1
/dev/sdb1 on /media/corsair type vfat (rw,noexec,nosuid,nodev,noatime,uid=1249,utf8,shortname=lower)
Code:
ll -d /media/corsair/
drwxr-xr-x 8 btest root 8192 Jan  1  1970 /media/corsair/
How can the mount of the device have weaker perms than the underlying device??

This is with a KDE desktop ontop.


Thanks for reading.

Last edited by DaveQB; 10-29-2009 at 02:39 AM.. Reason: typo, changed title
linux DaveQB is offline  
Tag This Post , ,
Reply With Quote
Old 10-25-2009, 10:53 PM   #2
DaveQB
Member
 
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Mandriva 2009.1, Debian Etch
Posts: 344
Thanked: 7

Original Poster
I wasn't wrong thinking it was a tough one

I am going to venture more into this today. Fingers crossed.
linux DaveQB is offline     Reply With Quote
Old 10-29-2009, 02:38 AM   #3
DaveQB
Member
 
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Mandriva 2009.1, Debian Etch
Posts: 344
Thanked: 7

Original Poster
So now I think its controlled by hal.
When I saw this in the logs:

hald: mounted /dev/sdb1 on behalf of uid 1249

http://www.jefferyfernandez.id.au/20...ng-of-volumes/

http://wiki.archlinux.org/index.php/HAL

The former site looked promising and the default hal.conf file I had was much more open, allowing alot [on a default CentOS 5.3 install]

/etc/dbus-1/system.d/hal.conf

so I trimmed it down and also tried just copying and pasting the one from the article that was the restrictive one, but I could still mount a USB thumb drive.

So I am lost now. I even cut the hal.conf down even further, so minimal I thought it would break, but still able to mount as a simple user.

I did notice this in the logs:

userhelper[3317]: running '/usr/sbin/eject /dev/sdb1' with root privileges on behalf of 'btest'

But userhelper is from the usermode package which seems to only pertain to halting, shutting down and rebooting.

Damn, why is this so hard!

It looks like Fedora has gone to PolicyKit, so I can't get any help from there.
linux DaveQB is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to load a firmware file in CentOS with udev / hotplug? ptemmerman Linux - Newbie 3 05-06-2009 03:56 PM
CentOS v5.2 - Unable to start udev Arty Ziff Linux - Server 3 12-03-2008 08:16 AM
Starting udev on CentOS problem Captain Civic Linux - Newbie 6 03-26-2008 12:05 AM
My CentOS installation stops booting at udev service arijit_2404 Linux - Desktop 3 11-11-2007 11:09 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 04:43 AM


All times are GMT -5. The time now is 08:55 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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration