1 .\" Copyright (c) 2011-2012 Devin Teske
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd safely edit system rc files
37 .Op Fl j Ar jail | Fl R Ar dir
38 .Ar name Ns Op = Ns Ar value
43 .Op Fl j Ar jail | Fl R Ar dir
50 variables from the collection of system rc files and allows processes with
51 appropriate privilege to change values in a safe and effective manner.
53 The following options are available:
54 .Bl -tag -width indent+
56 Dump a list of all non-default configuration variables.
58 Dump a list of all configuration variables
61 Print a description of the given variable.
63 Show default value(s) only (this is the same as setting RC_CONFS to NULL or
64 passing `-f' with a NULL file-argument).
66 Print query results as
68 .Pq useful for producing output to be fed back in .
73 Operate on the specified file(s) instead of the files obtained by reading the
78 This option can be specified multiple times for additional files.
82 file each directive is in.
84 Print a short usage message to stderr and exit.
86 Print a full usage statement to stderr and exit.
88 Ignore unknown variables.
95 .Pq overrides So Fl R Ar dir Sc ; requires Xr jexec 8 .
97 Show only variable values, not their names.
99 Show only variable names, not their values.
101 Quiet. Ignore previous
106 Operate within the root directory
111 Verbose. Print the pathname of the specific
113 file where the directive was found.
115 Remove variable(s) from specified file(s).
118 This utility works similar to
120 It shares the `-e' and `-n' options
122 and also has the same
124 syntax for querying/setting configuration options.
128 serves to query/modify MIBs in the entrant kernel,
130 instead works on values in the system
134 The list of system configuration files is configured in the file
135 .Ql /etc/defaults/rc.conf
138 which by-default contains a space-separated list of pathnames. On all FreeBSD
139 systems, this defaults to the value "/etc/rc.conf /etc/rc.conf.local". Each
140 pathname is sourced in-order upon startup. It is in the same fashion that
142 sources the configuration files before returning the value of the given
145 When supplied a variable name,
147 will return the value of the variable. If the variable does not appear in any
150 an error is printed and error status is returned.
152 When changing values of a given variable, it does not matter if the variable
153 appears in any of the
155 or not. If the variable does not appear in any of the files, it is appended to
156 the end of the first pathname in the
160 will replace only the last-occurrence in the last-file found to contain the
161 variable. This gets the value to take effect next boot without heavily
162 modifying these integral files (yet taking care not to allow the file to
165 be called repeatedly).
167 The following environment variables are referenced by
169 .Bl -tag -width ".Ev SYSRC_VERBOSE"
173 .Pq even if set to NULL .
176 .Ql /etc/defaults/rc.conf
179 Default verbosity. Set to non-NULL to enable.
182 The following standard commands are required by
200 .Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
201 .It Pa /etc/defaults/rc.conf
203 .It Pa /etc/rc.conf.local
206 Below are some simple examples of how
208 can be used to query certain values from the
210 collection of system configuration files:
214 .Dl returns the value of $sshd_enable, usually YES or NO .
218 .Dl returns IP address of default router Pq if configured .
220 Working on other files, such as
224 -f /etc/crontab MAILTO
225 .Dl returns the value of the MAILTO setting Pq if configured .
227 In addition to the above syntax,
231 PARAMETER expansion for changing the way values are reported, shown below:
235 .Dl returns $hostname up to (but not including) first `.' .
238 \&'network_interfaces%%[$IFS]*'
239 .Dl returns first word of $network_interfaces .
242 \&'ntpdate_flags##*[$IFS]'
243 .Dl returns last word of $ntpdate_flags (time server address) .
247 .Dl returns $usbd_flags or "default" if unset or NULL .
250 cloned_interfaces+"alternate"
251 .Dl returns "alternate" if $cloned_interfaces is set .
254 \&'#kern_securelevel'
255 .Dl returns length in characters of $kern_securelevel .
259 .Dl returns NULL and error status 2 if $hostname is unset Pq or if set, returns the value of $hostname with no error status .
263 .Dl returns NULL and error status 2 if $hostname is unset or NULL Pq or if set and non-NULL, returns value without error status .
267 utility presently does not support the
269 collection of system configuration files
270 .Pq which requires a service name to be known during execution .
272 This will be corrected by a future enhancement.
283 utility first appeared in
286 .An Devin Teske Aq dteske@FreeBSD.org
288 Brandon Gooch, Garrett Cooper, Julian Elischer, Pawel Jakub Dawidek,
289 Cyrille Lefevre, Ross West, Stefan Esser, Marco Steinbach, and Jilles Tjoelker
290 for suggestions and help.