Understanding FreeBSD's service management system: /etc/rc.conf as the center of configuration, rc scripts in /etc/rc.d, and the service command for runtime control. You will also learn the boot order of the loader, kernel, and rc, and use sysrc to manage configuration without a manual editor.

In the previous episode 5, you managed users and groups with pw and understood privilege escalation. Now we enter the heart of system automation: how services are started, stopped, and enabled automatically at boot.
FreeBSD uses a SysV-style rc system that is simple and predictable. Configuration is centralized in /etc/rc.conf, service scripts live in rc.d directories, and runtime control is handled by the service command. Combined with sysrc, you can manage all of it from the CLI without touching an editor. Let's dissect it layer by layer.
All decisions about "which services are active" and "how they're configured" live in /etc/rc.conf. This is the only file you need to enable a service:
hostname="server01"
sshd_enable="YES"
ntpd_enable="YES"
ifconfig_em0="DHCP"The pattern to watch for: service_enable="YES". The variable starts with the service name and ends with _enable. When bsdinstall creates your system, this file already contains the basic configuration.
FreeBSD stores the default values of all variables in /etc/defaults/rc.conf. Never edit this file — its values are overwritten on upgrade. Just read it to understand the available variables, then override them in /etc/rc.conf:
grep -E "sshd|ntpd" /etc/defaults/rc.confThe simple rule is: edit /etc/rc.conf, never touch /etc/defaults/rc.conf.
Warning
A common mistake for Linux users moving to FreeBSD is looking for service configuration in each service's own files, like sshd_config, to set "enable". On FreeBSD, application config files and enable settings are two separate things: enabling goes in rc.conf, application parameters go in the application's own config file.
Scripts that control services live in two locations:
/etc/rc.d/ — services that are part of the base system (sshd, ntpdate, routing)./usr/local/etc/rc.d/ — services from pkg and ports (nginx, mysql, doas).Each script supports standard actions: start, stop, restart, status, reload, and rcvar. Read a script to understand the variables it supports:
service sshd rcvarThe output shows the sshd_enable="YES" line and sshd_flags — exactly what you need to put in rc.conf.
Once a service is enabled, manage its runtime state with service:
service sshd start
service sshd status
service sshd restart
service sshd stopservice <name> onestart is useful for running a service that isn't enabled in rc.conf — it runs once without making it persistent at boot:
service nginx onestartYou can also place custom scripts in /usr/local/etc/rc.d to have them managed the same way. I'll cover this pattern further in episode 11 when we build a custom service.
Understanding the boot order helps you troubleshoot services that don't appear at start:
/boot/loader.conf and loads the kernel.init and /etc/rc./etc/rc reads /etc/defaults/rc.conf + /etc/rc.conf, then runs the rc scripts in order.The boot process log is stored in /var/log/boot.log (if enabled) and can be inspected with dmesg. If a service fails to start, note its order here.
For one-shot commands at the end of boot, FreeBSD supports /etc/rc.local. This file is executed last, after all services:
echo "Boot selesai" > /var/log/rc.local.logInfo
Use /etc/rc.local wisely. For work that must be restartable or controllable, it's better to write a proper rc script than to hide everything in an rc.local that's hard to audit.
sysrc is the tool that makes managing rc.conf without an editor possible. Its syntax resembles changing shell variables:
sysrc sshd_enable="YES"
sysrc nginx_enable="YES"
sysrc nginx_flags="-c /usr/local/etc/nginx/nginx.conf"sysrc reads and writes /etc/rc.conf, creates a backup before changes, and preserves the file format. Check existing values:
sysrc sshd_enable
sysrc -asysrc -a displays the entire contents of rc.conf. This is a quick way to audit what's active on the system. Because it edits files programmatically, sysrc is perfect for provisioning scripts and automation playbooks.
Success
The combination of sysrc for setting config and service for controlling runtime is a pair of keywords you'll use every day on FreeBSD. Both are idempotent and easy to learn — great for automation and executable documentation.
Let's practice the complete pattern for enabling nginx from pkg:
pkg install nginx
sysrc nginx_enable="YES"
service nginx start
service nginx statusThese four lines are the pattern you'll repeat for nearly every service: install, enable, start, verify. Remember, sysrc replaces the need to open an editor for enable settings.
In this episode 6, you understood the FreeBSD rc system: /etc/rc.conf as the center of configuration, /etc/defaults/rc.conf as default values that must not be edited, rc scripts in two directories, the service command for runtime control, the boot order, and sysrc as a CLI-based configuration manager.
Key takeaways:
/etc/rc.conf with the pattern service_enable="YES"./etc/defaults/rc.conf — it holds defaults that are overwritten on upgrade.service <name> start/stop/restart/status controls the runtime./etc/rc, then rc scripts.sysrc changes rc.conf without an editor and is safe for automation.In the next episode, episode 7, we'll cover filesystems, mounts & disks — from UFS and ZFS, pseudo-filesystems like tmpfs and devfs, to mount and umount, /etc/fstab configuration, and swap management. This storage foundation determines how your data lives on disk.