LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
Search this Thread
Old 05-12-2010, 03:42 AM   #1
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Rep: Reputation: 86
Creating an udev rule mounting all usb drive as 666


Hi, i need all my /media/* newly created by insertion of usb drives, chmodded 666.
I tried some tips using various threads, but i failed.
I'm on Slack 64 13.0.
 
Old 05-12-2010, 04:27 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
If you chmod a directory 666 then you will not be able to open it. So why do you want to do that ?
 
Old 05-12-2010, 04:57 AM   #3
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
Oh !
So 777 ?
I want all users to be able to write/read without any restriction.
 
Old 05-12-2010, 06:40 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
You could write a local udev rule to make it so. The best guide to writing udev rules that I know of is here. Let us know how you get on.
 
Old 05-12-2010, 07:30 AM   #5
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
I've been looking and it seems to be difficult to do it using udev. But I'm using Fedora, so you might have more luck.

What I've found is it is better to use udev to give a specific device a constant name, then use that to create an fstab entry, where you can specify the permissions more easily.

Of course you need to know the usb devices specifications and attributes first.


In Fedora, udev hands off all usb interaction to hal which doesn't seem to have any permissions config accessible.

Also, bear in mind that anything with a windows filesystem will be limited, because it doesn't understand permissions.
 
Old 05-12-2010, 09:17 AM   #6
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
I have difficulties to set a working rule, even using the guide...
And it's not for a specific drive. Every plugged key must have 777.
I just need permission for the key root folder.
 
Old 05-12-2010, 09:51 AM   #7
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
Well in Fedora the usb drive is always mounted as owned by the user who mounted it. So they will have to change the permissions appropriately. I can't find out where the default permissions are set. Maybe it's easier to make a udev rule that runs a script, and the script then does the chmod.

something like

Code:
KERNEL=="sd?1", DRIVERS=="usb", ACTION=="add", RUN+="/path/to/script"
This assumes your devices are being given device names under sd (sdb1, sdg1, etc)

You might try using OPTIONS+="last_rule" too.

But as I say, I can't make it work using udev. All the web resources I've found refer to an older version of Fedora where there was a 50-udev.rules which no longer exists.

Also, according to the link that catkin gave, only on some devices can you affect ownership. It doesn't specify which devices !
 
Old 05-12-2010, 09:56 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by Linux.tar.gz View Post
I have difficulties to set a working rule, even using the guide...
And it's not for a specific drive. Every plugged key must have 777.
I just need permission for the key root folder.
On reflection you want to have 777 permissions on the root folder of the file system. The actual /dev/sd<letter><number> device file just needs the normal root/disk 0660, like this
Code:
root@CW8:~# ls -l /dev/sd[ab][1-9]
brw-rw---- 1 root disk 8,  1 2010-05-12 16:22 /dev/sda1
brw-rw---- 1 root disk 8,  2 2010-05-12 16:22 /dev/sda2
brw-rw---- 1 root disk 8,  3 2010-05-12 16:22 /dev/sda3
brw-rw---- 1 root disk 8,  4 2010-05-12 16:22 /dev/sda4
brw-rw---- 1 root disk 8,  5 2010-05-12 16:22 /dev/sda5
brw-rw---- 1 root disk 8,  6 2010-05-12 16:22 /dev/sda6
brw-rw---- 1 root disk 8,  7 2010-05-12 16:22 /dev/sda7
brw-rw---- 1 root disk 8,  8 2010-05-12 16:22 /dev/sda8
brw-rw---- 1 root disk 8,  9 2010-05-12 16:22 /dev/sda9
brw-rw---- 1 root disk 8, 17 2010-05-12 16:22 /dev/sdb1
brw-rw---- 1 root disk 8, 18 2010-05-12 16:22 /dev/sdb2
brw-rw---- 1 root disk 8, 21 2010-05-12 16:22 /dev/sdb5
brw-rw---- 1 root disk 8, 22 2010-05-12 16:22 /dev/sdb6
With that set (which is default) the kernel will mount the file system in the default way and any 777 on the file system root directory is internal to the file system itself.

What is the output of /bin/ls -ld /media/* when you have some of these USB keys plugged in?
 
Old 05-12-2010, 10:18 AM   #9
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
It's rw r r
I need at least rw rw r

And indeed, rules.d used to be highly populated, but now i have to set rules from scratch, which didn't worked well for now

Last edited by Linux.tar.gz; 05-12-2010 at 10:20 AM.
 
Old 05-17-2010, 08:29 AM   #10
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
Shoulda have tried this before... chmod 0777 /dev/media/* doesn't work.
It's impossible to change anything. It belongs to the user and the group root.
Do someone knows where this behavior is set ?
 
Old 05-17-2010, 09:15 AM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by Linux.tar.gz View Post
Shoulda have tried this before... chmod 0777 /dev/media/* doesn't work.
It's impossible to change anything. It belongs to the user and the group root.
Do someone knows where this behavior is set ?
It is set when the files-and-directories are created. If they belong to root then you need to have root privileges to change them, by logging on as root or by using sudo or su.
 
Old 05-20-2010, 08:16 AM   #12
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
Ooops i meant /media, not /dev/media

No i can't change permission as root.

Ex. /media/KINGSTON is drwxr-xr-x
it belongs to me, and group root.
I can't change this.
 
Old 05-20-2010, 10:54 AM   #13
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
Found rules are now in /lib/udev/rules.d
Added MODE="0777" @ usb line in 65-permissions.rules

/dev/sd* are now rwxrwxrwx

Still can't make /media/KINGSTON writable by all users.

Maybe should i investigate HAL ?
 
Old 05-20-2010, 03:13 PM   #14
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
The problem may caused by how the file systems are mounted. They may be mounted read-only; that would explain why you are not able to change them despite their /dev/ files now being 777 (660 should be plenty). How are you mounting them?
 
Old 05-21-2010, 05:01 AM   #15
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,227

Original Poster
Rep: Reputation: 86
It's mounted via udev/hal and Xfce volman.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] udev rules to automatically apply 666 permission linuxmandrake Linux - Newbie 2 04-03-2010 03:31 AM
slackware 12.0, udev rules for usb-dev works, but mounting does not work correct paalmarker Linux - General 5 03-30-2010 01:51 AM
? on accessing usb drive in SuSE 10 with udev steve_f60 Linux - Newbie 1 03-05-2008 08:21 PM
Can I make a udev rule for a particular usb port? kairen Slackware 3 02-15-2008 08:30 AM
Trying to use udev to auto mount usb drive njnear Linux - General 5 12-04-2007 01:53 AM


All times are GMT -5. The time now is 02:43 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