OpenBSD Journal

New sysctl(8) -f option supports reading entire settings file in one go

Contributed by Peter N. M. Hansteen on from the ctl my sys dept.

If you have ever been irked by having to enter a sequence of sysctl(8) commands to achieve things like enabling forwarding for IPv4 and IPv6 both, help is at hand.

In a recent commit, Klemens Nanni (kn@) added functionality to have the classic command read multiple settings from a file:

Subject:    CVS: cvs.openbsd.org: src
From:       Klemens Nanni <kn () cvs ! openbsd ! org>
Date:       2025-04-05 14:09:06
Message-ID: f3c322a675a4cd33 () cvs ! openbsd ! org
[Download RAW message or body]

CVSROOT:	/cvs
Module name:	src
Changes by:	kn@cvs.openbsd.org	2025/04/05 08:09:06

Modified files:
	sbin/sysctl    : sysctl.8 sysctl.c 

Log message:
Add [-f file] to apply sysctl.conf in one go
Intended as simpler alternative to scripting around a list of assignments
(or passing multiple on the command line), which is useful for the
occasional local edit-and-apply as well as config management tools handling
sysctl.conf(5) incl. comments.

deraadt millert like it

This change (predictably) also spurred a few changes to the rc scripts, and the whole thing will be available in a upcoming snapshots and the soon-to-arrive OpenBSD 7.7 release.


Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]