problem with linux usb device permission on reboot

0

THe below output from my terminal probably should make sense to those able to help:

[root@Plugbox ~]# cd /dev/bus/usb
[root@Plugbox usb]# ls
001
[root@Plugbox usb]# cd 001
[root@Plugbox 001]# ls -l
total 0
crw-rw-r-- 1 root root    189, 0 Mar 17 16:11 001
crw-rw-r-- 1 root scanner 189, 1 Mar 17 16:11 002
(at this point I can not print)
[root@Plugbox 001]# chown root:lp 001
[root@Plugbox 001]# chown root:lp 002
[root@Plugbox 001]# ls -l
total 0
crw-rw-r-- 1 root lp 189, 0 Mar 17 16:11 001
crw-rw-r-- 1 root lp 189, 1 Mar 17 16:11 002
(now the printing starts)

The system is a plug computer running Plugbox linux (http://plugapps.com). When it uses CUPS for printing and Samba to share this with my windows network.

I'm sure the details are irrelevent, but my problem is that I require the printer to belong to the lp group when it is connected. How do I go about doing this?

I assume I use the permissions files in rules.d but I am unsure of the syntax.

Thanks

Hamid

Posted 2011-03-17T21:19:28.753

Reputation: 123

Answers

0

I have not tested it, but I believe that this should work:

SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="07", ATTR{bInterfaceSubClass}=="01", GROUP="lp", MODE="660"

You have to place this line in a file under /etc/udev/rules.d/. Keep in mind that the files in that directory are parsed in alphabetic order. If there are other rules that match, you may have to choose an appropriate name for that file, so that it is parsed last.

thkala

Posted 2011-03-17T21:19:28.753

Reputation: 1 769

Thanks, ill give it a try. I did try it already using idVendor and idProduct for the particular device but it had no effect. I made it the last executes rule file in the directory. The problem with your version is that if it does work, all USB devices will belong to the group lp. I only want it to be true for the printer. – Hamid – 2011-03-20T10:59:14.993

@Hamid: not all devices - just all printers. The interface class and subclass constraints make sure of that. – thkala – 2011-03-20T11:51:23.760

I tried this at number 40. It seemed to make no difference. DO I possibly need to make the number higher to ensure the bus is initialized properly and the printer detected by the time it is run. At present, the printer belongs to root:root and the scanner is root:scanner (it's a multifunctional). – Hamid – 2011-03-20T20:25:03.810

@Hamid: why don't you have a look at the libsane rule file under rules.d? The logic for the printer shouldn't be all that different than then one for the scanner. – thkala – 2011-03-20T21:37:02.203

Thanks, I'll take a look as you suggested when I get home. – Hamid – 2011-03-21T10:27:58.127

Just an update, I tried the above and never did get this fixed or the permissions to be persistent, I ended up having to set the owner and group of the printer and scanner after every reboot, in the end I got a wireless printer and it connects straight to the network. – Hamid – 2011-07-31T21:17:22.713