FreeBSD devfs.rules(5)
I was experimenting with an RTL-SDR on FreeBSD.
I could run rtl_tcp
on Linux as a regular user but not on FreeBSD.
Checking the mode and no group or world permission bits were set.
crw------- 1 root operator 0x2b May 30 08:58 /dev/usb/0.1.0
I needed at least group permissions.
Because rtl_tcp
is getting data from the outside world I opted for a separate user for only that.
Conveniently, an example very similar to this was in the manpage for devfs.rules(5).
First I created a usb
user and group and now need to allow it to read USB devices.
USB devices appear in /dev/usb
so that path is what need to be used in the rules.
The name can be anything while the number is the ID of the rules.
Add this to /etc/devfs.rules
:
[localrules=10]
add path 'usb/*' mode 0660 group usb
Those new rules have to be enabled using that name.
Add this to /etc/rc.conf
:
devfs_system_ruleset="localrules"
To make the new rules take effect, devfs needs to be restarted:
/etc/rc.d/devfs restart
Now, this is what the USB device looks like:
crw-rw---- 1 root usb 0x2e May 30 07:59 /dev/usb/0.1.0