Albrechts Blog

About programming, mostly.

How to Disable Daemons Under Ubuntu 12.04 and Above

Ubuntu uses the upstart system to start several services. Every service controlled via upstart has a .conf file in the directory /etc/init, so you can list the available services using ls -l /etc/init/*.conf

To disable a service, upstart supports a “manual” configuration element, that can be placed either in the <service>.conf file or in an overriding file <service>.override using sudo sh -c “echo ‘manual’ > /etc/init/SERVICE.override”

To reenable the service just delete the .override file.

Not every service is controlled via upstart, on my system e.g. nessus is controlled via init.d. Services controlled via init.d are configured using an executable script in /etc/init.d and links to this script, that are located in /etc/rc?.d, according to the certain runlevels. To disable such a service, the easiest option is to remove the executable flag from the script, such as

sudo chmod -x /etc/init.d/nessusd

To revert your decision, just add the executable bit again:

sudo chmod +x /etc/init.d/nessusd