1d854ee07SGiorgos Keramidas.\" Copyright (c) 2004 Roland Smith <rsmith@xs4all.nl> 2d854ee07SGiorgos Keramidas.\" All rights reserved. 3d854ee07SGiorgos Keramidas.\" 4d854ee07SGiorgos Keramidas.\" Redistribution and use in source and binary forms, with or without 5d854ee07SGiorgos Keramidas.\" modification, are permitted provided that the following conditions 6d854ee07SGiorgos Keramidas.\" are met: 7d854ee07SGiorgos Keramidas.\" 1. Redistributions of source code must retain the above copyright 8d854ee07SGiorgos Keramidas.\" notice, this list of conditions and the following disclaimer. 9d854ee07SGiorgos Keramidas.\" 2. Redistributions in binary form must reproduce the above copyright 10d854ee07SGiorgos Keramidas.\" notice, this list of conditions and the following disclaimer in the 11d854ee07SGiorgos Keramidas.\" documentation and/or other materials provided with the distribution. 12d854ee07SGiorgos Keramidas.\" 13d854ee07SGiorgos Keramidas.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14d854ee07SGiorgos Keramidas.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15d854ee07SGiorgos Keramidas.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16d854ee07SGiorgos Keramidas.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17d854ee07SGiorgos Keramidas.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18d854ee07SGiorgos Keramidas.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19d854ee07SGiorgos Keramidas.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20d854ee07SGiorgos Keramidas.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21d854ee07SGiorgos Keramidas.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22d854ee07SGiorgos Keramidas.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23d854ee07SGiorgos Keramidas.\" SUCH DAMAGE. 24d854ee07SGiorgos Keramidas.\" 254102e838SJohn-Mark Gurney.Dd December 1, 2020 26d854ee07SGiorgos Keramidas.Dt DEVFS.RULES 5 27d854ee07SGiorgos Keramidas.Os 28d854ee07SGiorgos Keramidas.Sh NAME 29d854ee07SGiorgos Keramidas.Nm devfs.rules 30d854ee07SGiorgos Keramidas.Nd devfs configuration information 31d854ee07SGiorgos Keramidas.Sh DESCRIPTION 32d854ee07SGiorgos KeramidasThe 33d854ee07SGiorgos Keramidas.Nm 34d854ee07SGiorgos Keramidasfile provides an easy way to create and apply 35d854ee07SGiorgos Keramidas.Xr devfs 8 36d854ee07SGiorgos Keramidasrules, even for devices that are not available at boot. 37d854ee07SGiorgos Keramidas.Pp 38d854ee07SGiorgos KeramidasFor devices available at boot, see 39d854ee07SGiorgos Keramidas.Xr devfs.conf 5 . 40d854ee07SGiorgos Keramidas.Pp 41d854ee07SGiorgos KeramidasThe format of this file is simple. 42d854ee07SGiorgos KeramidasEmpty lines and lines beginning with a hash sign 43d854ee07SGiorgos Keramidas.Pq Ql # 44d854ee07SGiorgos Keramidasare ignored. 45d854ee07SGiorgos KeramidasA line between brackets denotes the start of a ruleset. 46d854ee07SGiorgos KeramidasIn the brackets should be the name of the ruleset and its number, 47d854ee07SGiorgos Keramidasseparated by an equal sign. 48d854ee07SGiorgos Keramidas.Pp 49d854ee07SGiorgos KeramidasOther lines are rule specifications as documented in 50d854ee07SGiorgos Keramidas.Xr devfs 8 , 51d854ee07SGiorgos Keramidasin the section 52a4be0b3cSRuslan Ermilov.Sx "Rule Specification" . 53d854ee07SGiorgos KeramidasThese lines are prepended with 54d854ee07SGiorgos Keramidas.Dq Li rule 55d854ee07SGiorgos Keramidasand are passed to 56d854ee07SGiorgos Keramidas.Xr devfs 8 57d854ee07SGiorgos Keramidasby the startup scripts of the system. 58d854ee07SGiorgos KeramidasIt is important to put path elements that contain 59d854ee07SGiorgos Keramidas.Xr glob 3 60d854ee07SGiorgos Keramidasspecial characters between quotes. 612882d87eSGiorgos Keramidas.Pp 622882d87eSGiorgos KeramidasRulesets should have a unique name and number. 632882d87eSGiorgos Keramidas.Pp 642882d87eSGiorgos KeramidasAll rules that follow a ruleset declaration belong to that ruleset, until a 652882d87eSGiorgos Keramidasnew ruleset is started. 662882d87eSGiorgos Keramidas.Pp 672882d87eSGiorgos KeramidasOne custom ruleset has to be enabled in 682882d87eSGiorgos Keramidas.Pa /etc/rc.conf , 69fbf9b468SJoel Dahlotherwise it will not be applied to the 702882d87eSGiorgos Keramidas.Pa /dev 712882d87eSGiorgos Keramidasfile system by the default system startup process. 722882d87eSGiorgos KeramidasFor example, to enable a 732882d87eSGiorgos Keramidas.Dq Li localrules 742882d87eSGiorgos Keramidasruleset for the 752882d87eSGiorgos Keramidas.Pa /dev 762882d87eSGiorgos Keramidasfile system, you would have to use something like this in your 772882d87eSGiorgos Keramidas.Pa rc.conf 782882d87eSGiorgos Keramidasfile: 792882d87eSGiorgos Keramidas.Bd -literal -offset indent 802882d87eSGiorgos Keramidasdevfs_system_ruleset="localrules" 812882d87eSGiorgos Keramidas.Ed 824102e838SJohn-Mark Gurney.Pp 834102e838SJohn-Mark GurneyThe rules are loaded at boot via the devfs service. 844102e838SJohn-Mark GurneyTo load modified rules after the system has booted, run the command: 854102e838SJohn-Mark Gurney.Bd -literal -offset indent 864102e838SJohn-Mark Gurneyservice devfs restart 874102e838SJohn-Mark Gurney.Ed 88a4be0b3cSRuslan Ermilov.Sh FILES 89a82b501bSGlen Barber.Bl -tag -compact -width Pa 90a4be0b3cSRuslan Ermilov.It Pa /etc/defaults/devfs.rules 91ebae8e93SGavin AtkinsonDefault 92ebae8e93SGavin Atkinson.Nm 93ebae8e93SGavin Atkinsonconfiguration file. 94ebae8e93SGavin Atkinson.It Pa /etc/devfs.rules 95ebae8e93SGavin AtkinsonLocal 96ebae8e93SGavin Atkinson.Nm 97eb49a6d3SEdward Tomasz Napieralaconfiguration file. 98eb49a6d3SEdward Tomasz NapieralaRulesets in here override those in 99ebae8e93SGavin Atkinson.Pa /etc/defaults/devfs.rules 100ebae8e93SGavin Atkinsonwith the same ruleset number, otherwise the two files are effectively merged. 101a4be0b3cSRuslan Ermilov.El 102d854ee07SGiorgos Keramidas.Sh EXAMPLES 103d854ee07SGiorgos KeramidasTo make all the partitions of 104d854ee07SGiorgos Keramidas.Xr da 4 105d854ee07SGiorgos Keramidasdevices readable and writable by their owner and the 106d854ee07SGiorgos Keramidas.Dq Li usb 107d854ee07SGiorgos Keramidasgroup, the following rule may be used: 108a4be0b3cSRuslan Ermilov.Pp 1092882d87eSGiorgos Keramidas.Dl "[localrules=10]" 110a4be0b3cSRuslan Ermilov.Dl "add path 'da*s*' mode 0660 group usb" 111d854ee07SGiorgos Keramidas.Pp 1122882d87eSGiorgos KeramidasThe first line declares and starts a new ruleset, with the name 1132882d87eSGiorgos Keramidas.Va localrules 1142882d87eSGiorgos Keramidasand the number 10. 1152882d87eSGiorgos Keramidas.Pp 116b90dfaf3SAndrew ThompsonTo give 117b90dfaf3SAndrew Thompson.Xr usbconfig 8 118b90dfaf3SAndrew Thompsonand 119b90dfaf3SAndrew Thompson.Xr libusb 3 120b90dfaf3SAndrew Thompsonenabled applications permission to all usb devices for their owner and the 121d854ee07SGiorgos Keramidas.Dq Li usb 122d854ee07SGiorgos Keramidasgroup, a similar rule may be used: 123a4be0b3cSRuslan Ermilov.Pp 124b90dfaf3SAndrew Thompson.Dl "add path 'usb/*' mode 0660 group usb" 125d854ee07SGiorgos Keramidas.Sh SEE ALSO 126d854ee07SGiorgos Keramidas.Xr glob 3 , 127*1a720cbeSAlexander Ziaee.Xr devfs 4 , 128d854ee07SGiorgos Keramidas.Xr devfs.conf 5 , 1294102e838SJohn-Mark Gurney.Xr devfs 8 , 1304102e838SJohn-Mark Gurney.Xr service 8 131d854ee07SGiorgos Keramidas.Sh AUTHORS 132a4be0b3cSRuslan ErmilovThis manual page was written by 133a63d6c94SBaptiste Daroussin.An Roland Smith Aq Mt rsmith@xs4all.nl . 134