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