# USB CD/DVD default access perms.



## Rommi (Sep 16, 2010)

Hello,

How do I set default access permissions for the external USB CD/DVD drive? Setting such to /etc/devfs.conf is useless because drive usually is not present on boot. Adding myself to the operator group has also no effect because permissions on /dev/cd1 and /dev/pass1 are 0600. Changing perms. manually every time I hotplug the device and wanna burn something is annoying.


----------



## Pjoter (Sep 16, 2010)

Hi,

but once device is connected (I assume that under the same device name) devfs should grant permissions. Please read more about devfs: http://www.freebsd.org/cgi/man.cgi?query=devfs.conf&sektion=5

Perhaps using hal may help- but this is not the default way I am afraid.

Pjoter.


----------



## Rommi (Sep 16, 2010)

Thanks, but in the link you've sent, right in the second paragraph, it says: "It does not work for devices plugged in and out after the system is up and running, e.g. USB devices". That is just the case I am in. Currently thinking to utilize dbus, but hope that there might be an easier way.


----------



## wblock@ (Sep 16, 2010)

Rommi said:
			
		

> Thanks, but in the link you've sent, right in the second paragraph, it says: "It does not work for devices plugged in and out after the system is up and running, e.g. USB devices". That is just the case I am in. Currently thinking to utilize dbus, but hope that there might be an easier way.



devfs.rules(5) is the usual way.  Restart devfs(8) after making changes to the rules:
`# /etc/rc.d/devfs restart`

You can do more complicated things with devd.conf(5), but it's, well, more complicated.


----------



## Pjoter (Sep 16, 2010)

Hi,

I don't know if what is said in manual is truth. I checked that- I have USB DVD recorded appearing as cd1:


```
crw-rw-rw-   1 root     operator    0, 128 16 wrz 18:59 cd0
crw-rw-rw-   1 root     operator    0, 153 16 wrz 19:55 cd1
lrwxr-xr-x   1 root     wheel            4 16 wrz 18:59 cdrom -> acd0
lrwxr-xr-x   1 root     wheel            3 16 wrz 18:59 dvd -> cd0
crw-rw-rw-   1 root     operator    0, 153 16 wrz 19:55 cd1
```

When I unplug and plug DVD I get:


```
crw-rw-rw-   1 root     operator    0,  99 16 wrz 18:59 acd0
crw-rw-rw-   1 root     operator    0, 128 16 wrz 18:59 cd0
crw-rw-rw-   1 root     operator    0, 153 16 wrz 19:57 cd1
lrwxr-xr-x   1 root     wheel            4 16 wrz 18:59 cdrom -> acd0
lrwxr-xr-x   1 root     wheel            3 16 wrz 18:59 dvd -> cd0
```

So it looks like it works.

I disabled hald and dbus and I get the same:


```
crw-rw-rw-   1 root     operator    0,  99 16 wrz 18:59 acd0
crw-rw-rw-   1 root     operator    0, 128 16 wrz 18:59 cd0
crw-rw-rw-   1 root     operator    0, 153 16 wrz 20:00 cd1
lrwxr-xr-x   1 root     wheel            4 16 wrz 18:59 cdrom -> acd0
lrwxr-xr-x   1 root     wheel            3 16 wrz 18:59 dvd -> cd0
```

Below attached devfs.conf:


```
link    acd0    cdrom
link    cd0     dvd
perm    acd0    0666
perm    da0     0666
perm    nvram   0666
perm    pass0   0666 
perm    xpt0    0666 
perm    agpart  0666
perm    uscanner0  0666
perm    mmcsd   0666
perm    mmc0    0666
perm    sdhci0  0666
```


----------



## Rommi (Sep 16, 2010)

Pjoter said:
			
		

> Hi,
> 
> I don't know if what is said in manual is truth. [...]



Hello.

Thanks, but I've tried it the same way and it didn't work for me... Do you always keep you drive _on_ when you boot the system? If so, then you may have the initial perms set up at boot or so...


----------



## Beastie (Sep 16, 2010)

Rommi, do as wblock says. Pjoter's solution is for devices that are available from the start, which is not your case.



> The *devfs.rules* file provides an easy way to create and apply devfs(8) rules, even for devices that are not available at boot.


(source: devfs.rule(5))


Create a /etc/devfs.rules file. Something like the following should be appropriate:

```
[localrules=5]
add path 'cd*' mode 0660 group operator
```
Then enable the ruleset inside /etc/rc.conf:

```
devfs_system_ruleset="localrules"
```


----------



## Pjoter (Sep 17, 2010)

Rommi said:
			
		

> Hello.
> 
> Thanks, but I've tried it the same way and it didn't work for me... Do you always keep you drive _on_ when you boot the system? If so, then you may have the initial perms set up at boot or so...




Yes I do keep them on boot. Must that I didn't read your post to the end  Sorry guys!

Pjoter.


----------

