Q. How do I disable services located at /etc/rc.d or /usr/local/etc/rc.d directory? For example I’d like to disable a service called /etc/rc.d/foo
A. FreeBSD services can be controlled by updating /etc/rc.conf file. The file rc.conf contains descriptive information about the local host name, configuration details for any potential network interfaces and which services should be started up at system initial boot time. You can edit file manually to remove entries. It is recommended that you use sysinstall utility to modify the /etc/rc.con file.
From the man page – The sysinstall utility is used for installing and configuring FreeBSD systems. It is the first utility invoked by the FreeBSD installation boot floppy and is also available as /usr/sbin/sysinstall on newly installed FreeBSD systems for use in later configuring the system. To start sysinstall login as root and enter:
Select Configure (Do post installation menu) > Startup (configure system startup options) > Use [Space] or [Enter] key to select / deselect services / items from a menu > Ok to save the changes.
Manually edit /etc/rc.conf
You can manually edit / update /etc/rc.conf file to enable or disable services:
# vi /etc/rc.conf
To disable sendmail at boot time, find line that read as follows:
Close and save the file.
Usually all services accepts – YES and NO parameters to enable or disable services. The correct way to figure out service parameter is by reading rc.conf man page. See rc.conf man page for more information:
Updated for accuracy.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|