Gentoo Archives: gentoo-dev

From: Martin Schlemmer <azarah@g.o>
To: Bauno <bauno@××××××.it>
Cc: Gentoo-Dev <gentoo-dev@g.o>
Subject: Re: [gentoo-dev] CDRW permissions and devfsd
Date: Tue, 03 Sep 2002 13:00:28
Message-Id: 1031075857.6710.35.camel@nosferatu.lan
In Reply to: Re: [gentoo-dev] CDRW permissions and devfsd by Bauno
1 On Tue, 2002-09-03 at 03:04, Bauno wrote:
2 > On Tuesday 03 September 2002 02:37, Martin Schlemmer wrote:
3 > > > [snipped]
4 > > > The original line in devfsd.conf (that you report above) doesn't work
5 > > > if sg is compiled as module. You need to set the permissions on the
6 > > > scsi/bus/.../generic and not on the symbolic links /dev/sg*. I *think*
7 > > > it's because /dev/sg* doesn't exist (yet) when devfsd tries to apply
8 > > > the permissions, but I may be wrong.
9 > >
10 > > No, the REGISTER means it only gets done when the /dev/sg0 device is
11 > > registered in the devfs namespace.
12 > >
13 > > The real fix for modules, is the line:
14 > >
15 > > LOOKUP ^sg.*$ MODLOAD ACTION sg
16 > >
17 > > which cause the "sg" module to be loaded when you "lookup" (try to
18 > > open) /dev/sg*
19 >
20 > I really don't think so (everything's wrapped):
21 >
22
23 I tend to disagree. At least if not as module:
24
25 ----------------------------------------------cut-------------------------------------------------
26 workshop portage # grep root\.cdrw /etc/devfsd.conf
27 #REGISTER ^sg0$ PERMISSIONS root.cdrw 660
28 workshop portage # ls -l /dev/scsi/host0/bus0/target0/lun0/generic
29 crw------- 1 workshop root 21, 0 Jan 1 1970 /dev/scsi/host0/bus0/target0/lun0/generic
30 workshop portage # vim /etc/devfsd.conf
31 workshop portage # grep root\.cdrw /etc/devfsd.conf
32 REGISTER ^sg0$ PERMISSIONS root.cdrw 660
33 workshop portage # killall -HUP devfsd
34 workshop portage # ls -l /dev/scsi/host0/bus0/target0/lun0/generic
35 crw-rw---- 1 root cdrw 21, 0 Jan 1 1970 /dev/scsi/host0/bus0/target0/lun0/generic
36 workshop portage # vim /etc/devfsd.conf
37 workshop portage # grep root\.cdrw /etc/devfsd.conf
38 #REGISTER ^sg0$ PERMISSIONS root.cdrw 660
39 workshop portage # killall -HUP devfsd
40 workshop portage # ls -l /dev/scsi/host0/bus0/target0/lun0/generic
41 crw-rw---- 1 root cdrw 21, 0 Jan 1 1970 /dev/scsi/host0/bus0/target0/lun0/generic
42 workshop portage # chmod 0600 /dev/scsi/host0/bus0/target0/lun0/generic
43 workshop portage # chown root.root /dev/scsi/host0/bus0/target0/lun0/generic
44 workshop portage # killall -HUP devfsd
45 workshop portage # ls -l /dev/scsi/host0/bus0/target0/lun0/generic
46 crw------- 1 root root 21, 0 Jan 1 1970 /dev/scsi/host0/bus0/target0/lun0/generic
47 workshop portage # vim /etc/devfsd.conf
48 workshop portage # grep root\.cdrw /etc/devfsd.conf
49 REGISTER ^sg.*$ PERMISSIONS root.cdrw 660
50 workshop portage # killall -HUP devfsd
51 workshop portage # ls -l /dev/scsi/host0/bus0/target0/lun0/generic
52 crw-rw---- 1 root cdrw 21, 0 Jan 1 1970 /dev/scsi/host0/bus0/target0/lun0/generic
53 workshop portage #
54 --------------------------------------------------------------------------------------------------
55
56 So it works for changing the permissions on sg0 and sg*. Like I already
57 said, because I usually have it compiled in, ill have to recompile and
58 check if as module.
59
60 Also, I think you are going about this the wrong way. devfsd acts on
61 triggers. The default of cdrecord is to probe /dev/sg*, and not
62 /dev/scsi/host.*/bus.*/target.*/lun.*/generic. Thus rmmod sg, change to
63 the "Default Gentoo style" devfsd.conf, killall -HUP devfsd, and then
64 do: ls /dev/sg0. After this check the permissions on
65 /dev/scsi/host0/bus0/target0/lun0/generic.
66
67
68 > Default Gentoo style:
69 >
70 > ------------------devfsd.conf-----------------------------------------------
71 >
72 > # Give the cdrw group write permissions to /dev/sg0
73 > # This is done to have non root user use the burner (scan the scsi bus)
74 > LOOKUP ^sg.*$ MODLOAD ACTION sg
75 > #REGISTER ^scsi/host.*/bus.*/target.*/lun.*/generic PERMISSIONS
76 > root.disk 660
77 > REGISTER ^sg.*$ PERMISSIONS root.disk 660
78 >
79 > --------------devfsd.conf---------------------------------------------------
80 >
81 > bauniga root # modprobe sg
82 > bauniga root # ll /dev/scsi/host0/bus0/target0/lun0/generic
83 > crw-r----- 1 root root 21, 0 Jan 1 1970
84 > /dev/scsi/host0/bus0/target0/lun0/generic
85 > bauniga root # killall -HUP devfsd
86 > bauniga root # ll /dev/scsi/host0/bus0/target0/lun0/generic
87 > crw-rw---- 1 root disk 21, 0 Jan 1 1970
88 > /dev/scsi/host0/bus0/target0/lun0/generic
89 >
90 >
91 >
92 >
93 > Bauno :) style:
94 >
95 > ----------------------------devfsd.conf------------------------------------
96 > # Give the cdrw group write permissions to /dev/sg0
97 > # This is done to have non root user use the burner (scan the scsi bus)
98 > LOOKUP ^sg.*$ MODLOAD ACTION sg
99 > REGISTER ^scsi/host.*/bus.*/target.*/lun.*/generic PERMISSIONS
100 > root.disk 660
101 > #REGISTER ^sg.*$ PERMISSIONS root.disk 660
102 > --------------devfsd.conf---------------------------------------------------
103 >
104 > bauniga root # modprobe sg
105 > bauniga root # ll /dev/scsi/host0/bus0/target0/lun0/generic
106 > crw-rw---- 1 root disk 21, 0 Jan 1 1970
107 > /dev/scsi/host0/bus0/target0/lun0/generic
108 >
109 >
110 > So, I think the Gentoo default devfsd.conf isn't well suited for the sg
111 > module....
112 >
113 > --
114 > Bauno - Eurydices, oro, properata retexite fata!
115 > "Even now I can feel it. Buried somewhere deep inside. Watching me...
116 > waiting. But you know what scares me the most. When I can't fight it
117 > anymore. When it takes over. When I totally lose control. I like it."
118 --
119
120 Martin Schlemmer
121 Gentoo Linux Developer, Desktop Team Developer
122 Cape Town, South Africa

Replies

Subject Author
Re: [gentoo-dev] CDRW permissions and devfsd Bauno <bauno@××××××.it>