# devfs.rules



## fernandel (Apr 11, 2021)

I have the same rules on the latop as I have on the other computer where rules works but on laptop doesn't:
sysctl.conf

```
vfs.usermount=1
```

devfs.rules

```
[devfsrules_common=7]                                                                                                                                                 
add path 'da[0-9]\*' mode 0660                                                                    
add path 'cd[0-9]\*' mode 0660                                                                    
add path 'pass[0-9]\*' mode 0660                                                                  
add path 'xpt[0-9]\*' mode 0660                                                                   
add path 'ugen[0-9]\*' mode 0660                                                                  
add path 'usbctl' mode 0660                                                                       
add path 'usb/*' mode 0660                                                                        
add path 'video[0-9]\*' mode 666                                                                  
add path 'dri/*'  mode 0660 group video
```

And when I try `mount /dev/da0p1 /mnt` I got: mount: /dev/da0p1: Operation not permitted

The user is member of Wheel and Operator  group.
What I am doing wrong, please?
Thank you.


----------



## fernandel (Apr 11, 2021)

Okay, allow me to mount in /home/user/whatever but not in /mnt or /media


----------



## Deleted member 30996 (Apr 11, 2021)

I'm a member of the wheel and operator groups. But I want it so only root can mount a drive then exit and access files from my usr account. I mount /media/da0s1 as well so I can't help you there. 

But my syntax is a bit different than yours. If you've the asterisk symbol that includes everything and you don't need to list `[0-9]\`:


```
[devfsrules_common=7]
add path 'ad*' mode 0666 group operator
add path 'da*' mode 0666 group operator
add path 'acd*' mode 0666 group operator
add path 'cd*' mode 0666 group operator
add path 'mmcsd*' mode 0666 group operator
add path 'pass*' mode 0666 group operator
add path 'xpt*' mode 0666 group operator
add path 'ugen*' mode 0666 group operator
add path 'usbctl' mode 0666 group operator
add path 'usb*' mode 0666 group operator
add path 'lpt*' mode 0666 group operator
add path 'ulpt*' mode 0666 group operator
add path 'unlpt*' mode 0666 group operator
add path 'fd*' mode 0666 group operator
add path 'uscan*' mode 0666 group operator
add path 'video*' mode 0666 group operator
add path 'dvb/*' mode 0666 group operator
```


----------



## SirDice (Apr 13, 2021)

fernandel said:


> And when I try `mount /dev/da0p1 /mnt` I got: mount: /dev/da0p1: Operation not permitted
> 
> The user is member of Wheel and Operator group.





fernandel said:


> Okay, allow me to mount in /home/user/whatever but not in /mnt or /media


You need to be the owner of the mount-point for `vfs.usermount` to work. Your user is not the _owner_ of /mnt or /media, that's why they fail. You are the _owner_ of /home/user/whatever and that's why it does work there. The devfs.rules(5) are not relevant in this case.


----------

