How To Enable Daemons In FreeBSD

Written 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 /etc/rc.conf.

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: ls /usr/local/etc/rc.d/

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 sshd daemon:

less /etc/rc.d/sshd

Somewhere near the top, you might find a line that looks something like:

# PROVIDE: sshd
# 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 /etc/rc.conf.

To edit the file, you can use ee, 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

Note: Replace 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 onestart:

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.

View Archive