Freebsd rc usage: Difference between revisions

From wikinotes
 
Line 29: Line 29:
</source>
</source>
</blockquote><!-- Managing Services -->
</blockquote><!-- Managing Services -->
= Rc Variables =
<blockquote>
You can use <code>sysrc</code> to programmatically retrieve <code>/etc/rc.conf</code> variables.
<syntaxhighlight lang="bash">
sysrc defaultrouter  # print current value
</syntaxhighlight>
</blockquote><!-- Rc Variables -->

Latest revision as of 18:34, 22 October 2022

Enabling and Configuring Services

All daemons are enabled, and primarily configured in the /etc/rc.conf. rcvars (variables which can be overridden in rc.conf) are listed in the program's rcscript /usr/local/etc/rc.d.

# /etc/rc.conf:

sshd_enable="YES"
sshguard_enable="YES"
sshguard_whitelist="/etc/sshguard.whitelist"

You can also use sysrc to programmatically access and control these variables, even append etc.

sysrc sshd_enable      # print current value
sysrc sshd_enable=YES  # assign new value

Managing Services

service sshguard start
service sshguard stop
service sshguard restart