How To Enable Daemons In FreeBSDWritten by: Donovan / Last updated: Aug 26, 2023
Want to know how to enable a daemon in FreeBSD?
In FreeBSD, daemons (which are background services) are typically managed using the
rc.d scripting framework.
To enable a daemon, you usually need to set an appropriate variable in
Here’s a general process:
1. Find the daemon’s startup script
Daemons have startup scripts located in
/usr/local/etc/rc.d/ (for software installed from ports or packages) or in
/etc/rc.d/ (for base system software).
You can check the scripts using:
2. Check the Script for the Name of the Control Variable
You can see how to enable or configure the daemon by examining its startup script. For example, if you want to know how to enable the
Somewhere near the top, you might find a line that looks something like:
# PROVIDE: sshd # REQUIRE: LOGIN # KEYWORD: shutdown
This indicates the name of the service (
sshd in this case).
3. Edit rc.conf
This file is where you specify which daemons to run. To enable the daemon, you’ll typically add a line like:
If the daemon has other configurations or options, they might also be specified in
To edit the file, you can use
vi, or any other text editor you’re comfortable with:
doas vi /etc/rc.conf
4. Start the Daemon
Once you’ve made the necessary changes to
/etc/rc.conf, you can start the daemon using its startup script:
doas service sshd start
sshd with the name of your desired service.
Remember too that if you only want to start a daemon once (not enable it), just use
doas service sshd onestart
5. Check the Daemon
You can check if the daemon is running with:
doas service sshd status
The exact name of the control variable (
sshd_enable in this case) might differ based on the daemon, so it’s important to check the corresponding
rc.d script or the daemon’s documentation.