xref: /freebsd/usr.sbin/sysconf/sysconf-sysctl.8 (revision b4a465e566a1850e232b454efe99e05c1ea93f67)
1.\" Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org>
2.\" Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org>
3.\"
4.\" SPDX-License-Identifier: BSD-2-Clause
5.\"
6.Dd August 2, 2026
7.Dt SYSCONF-SYSCTL 8
8.Os
9.Sh NAME
10.Nm "sysconf sysctl"
11.Nd configure boot-time sysctl.conf directives
12.Sh SYNOPSIS
13.Nm sysconf
14.Cm sysctl
15.Op Fl AcDeFinNqvVx
16.Op Fl j Ar jail | Fl R Ar dir
17.Op Fl f Ar file | Fl k Ar module
18.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value
19.Ar ...
20.Nm sysconf
21.Cm sysctl
22.Op Fl ADeFnNqvV
23.Op Fl f Ar file | Fl k Ar module
24.Fl a
25.Nm sysconf
26.Cm sysctl
27.Op Fl AaDinNq
28.Fl d
29.Op Ar name ...
30.Nm sysconf
31.Cm sysctl
32.Op Fl E
33.Op Fl k Ar module
34.Fl l | L
35.Sh DESCRIPTION
36The
37.Cm sysctl
38target of
39.Xr sysconf 8
40reads and modifies
41.Xr sysctl.conf 5
42configuration.
43Shared assignment syntax and options are documented in
44.Xr sysconf 8 ;
45multi-file write policy in
46.Xr sysconf-targets 8 .
47.Pp
48The stock file list is
49.Pa /etc/sysctl.conf ,
50.Pa /etc/sysctl.conf.local ,
51then
52.Pa /etc/sysctl.kld.d/ Ns Ar module Ns Pa .conf
53when
54.Fl k Ar module
55is given
56.Pq applied by Xr rc.subr 8 when the module loads .
57.Pp
58Values are quoted on write only when the value requires it
59.Pq embedded whitespace .
60.Pp
61When writing to the running system,
62each
63.Ar name Ns = Ns Ar value
64is validated against the kernel's sysctl tree first.
65An OID that cannot be set at run time
66.Pq non-leaf, read-only, or loader-only tunable
67is reported and skipped,
68while the remaining assignments are still applied.
69In particular,
70a loader-only tunable is reported as requiring the
71.Cm loader
72target instead
73.Pq see Xr sysconf-loader 8 .
74Numeric values are also checked against the OID's
75.Dv CTLTYPE
76.Po
77.Dv CTLTYPE_INT ,
78.Dv CTLTYPE_U64 ,
79and the other integer widths
80.Pc
81so an overflowing or non-numeric assignment cannot land in
82.Xr sysctl.conf 5
83and fail
84.Pq or apply truncated
85when
86.Xr sysctl 8
87loads the file at boot.
88.Pp
89An unknown OID
90.Pq often from a module that is not yet loaded
91is reported with a warning but still written,
92matching how
93.Xr init 8
94treats such lines in
95.Xr sysctl.conf 5 ;
96.Fl i
97and
98.Fl q
99suppress that warning.
100Validation is skipped entirely under
101.Fl R ,
102where the target system's kernel is not the running kernel.
103.Pp
104.Fl d
105descriptions for this target come from the running kernel
106.Pq as with Xr sysctl 8 Fl d ,
107not from a defaults file.
108.Sh FILES
109.Bl -tag -width "/etc/sysctl.conf.local" -compact
110.It Pa /etc/sysctl.conf
111Write target for new directives.
112.It Pa /etc/sysctl.conf.local
113Site-local overrides.
114.It Pa /etc/sysctl.kld.d/
115Module-specific drop-ins
116.Pq see Fl k .
117.El
118.Sh EXAMPLES
119.Dl sysconf sysctl kern.maxfiles=65536
120.Dl sysconf sysctl -F vfs.usermount
121.Dl sysconf sysctl -d kern.maxfiles
122.Dl sysconf sysctl -L
123.Dl sysconf sysctl -LE
124.Dl sysconf sysctl -k ipfw net.inet.ip.fw.verbose=1
125.Dl sysconf -x sysctl vfs.usermount
126.Dl sysconf -j www sysctl kern.ipc.somaxconn=1024
127.Pp
128An overflowing assignment is refused before the file is touched
129.Pq here an integer OID given a value beyond INT_MAX :
130.Pp
131.Dl sysconf sysctl security.bsd.see_other_uids=99999999999
132.Sh SEE ALSO
133.Xr sysctl.conf 5 ,
134.Xr sysconf 8 ,
135.Xr sysconf-loader 8 ,
136.Xr sysconf-targets 8 ,
137.Xr sysctl 8
138.Sh HISTORY
139The
140.Nm sysconf
141utility first appeared in
142.Fx 16.0 .
143.Sh AUTHORS
144.An Devin Teske Aq Mt dteske@FreeBSD.org
145.An Faraz Vahedi Aq Mt kfv@FreeBSD.org
146