A Novel about my FreeBSD journey

Use external devices on FreeBSD

With this guide, I will explain to you how we enable our users to use external devices.

We'll start with allowing users to provision devices:

$: doas sysctl vfs.usermount=1

If we have not put our user in the group “operator” and “dialer” (access to serial ports), this has to be done now:

$: doas pw group mod operator -m <username>
$: doas pw group mod dialer -m <username>

Now we need to give the operator group written permissions for USB devices by creating the file /etc/devfs.rules:

$: doas nano /etc/devfs.rules =>

[localrules=5]
add path 'da *' mode 0660 group operator
add path 'cd *' mode 0660 group operator
add path 'uscanner *' mode 0660 group operator
add path 'xpt *' mode 660 group operator
add path 'pass *' mode 660 group operator
add path 'md *' mode 0660 group operator
add path 'msdosfs / *' mode 0660 group operator
add path 'ext2fs / *' mode 0660 group operator
add path 'ntfs / *' mode 0660 group operator
add path 'usb / *' mode 0660 group operator

We declare the new rules:

$: doas sysrc devfs_system_ruleset=localrules

Then we activate the new rules:

$: doas service devfs restart

Finally, let's review the applications:

$: doas devfs rule show

Discuss...