LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   set block device 664 always (http://www.linuxquestions.org/questions/linux-software-2/set-block-device-664-always-351162/)

shanenin 08-08-2005 10:03 AM

set block device 664 always
 
I wrote a cd ripping script that uses a python module to read the disc id. This id is used for getting song info. The problem is this module fails if run by regular user. I am able to run it as regular user by doing this command]
Code:

chmod +r /dev/hdc
it seems to need read access of this block device to run properly. I would like to package this script for other users, but need to know the correct way to allow this module to run as regular user. Is chmod the only way to do this, that is only temporary. After a reboot it needs to be done again.

Half_Elf 08-08-2005 10:18 AM

Most of recent distro now use "udev" to manage /dev directory. It's like a "dynamicly generated" /dev folder, just like /proc or /sys.
It's possible to tell udevd to set special permission for certain devices at boot time, look in /etc/udev/rules.d

As example,
Code:

KERNEL="hdc",          NAME="%k",GROUP="cdrw" MODE="0664"
will set permission to "664" and the group to "cdrw" for this device.

Note,of course, all this only work if your distribution use udev. Otherwise, you could just add a your chmod line to some bootup script to make sure this is done when you reboot. Or you could give your own script special root priviledge?

shanenin 08-08-2005 10:41 AM

thanks, that seems to be what I need. It may get tricky making this protable to differnt distros. I noticed both my gentoo and ubuntu have a slightly different layout.


All times are GMT -5. The time now is 05:04 PM.