Translation(s): English

What is a daemon?

A daemon, or system service, is a background process usually started during the initial boot sequence by ?init. Daemons typically run independent of users, waiting for system events to occur and providing services in response. Some common daemons include:

Managing daemons in Debian

Debian makes use of System V-style init scripts for daemon management. This allows daemons to operate conditionally, based on the current RunLevel of the computer. For example, a daemon can be configured to run only when the computer is in single-user mode (runlevel 1) or, more commonly, when in multi-user mode (runlevels 2-5). For more information, see ?init and RunLevel.

A brief introduction to daemon scripts

Under Debian, daemon init scripts are stored in /etc/init.d/

When a daemon is enabled or disabled, symbolic links targeting the respective init script are created or removed under the various /etc/rc*.d/ directories, corresponding to the RunLevel(s) in which the daemon is to run.

To view a list of currently available services:

$ ls /etc/init.d

Common service tasks

Most system services accept a common set of options, which can be passed directly to the daemon script at the command line, for example:

# /etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.

A brief description of the most common options follows:

Starting and stopping daemons in this manner is temporary and will not survive a reboot. Refer to the next section to enable/disable daemons on a permanent basis.

Enable/disable daemons

Note: Many daemons provide essential services to a working Debian installation; others can pose unnecessary security risks when enabled carelessly. Caution should be used whenever managing daemons. When in doubt, refer to the documentation of the daemon itself.

Several tools exist to manage system services, including rcconf and sys-v-conf. The default tool however is update-rc.d and that is what the following examples use.

Enabling services

To (re)enable a service, using the default settings, run the following:

# update-rc.d <servicename> defaults

Disabling services

To disable a service, run the following in a terminal as root:

# update-rc.d -f <servicename> remove

For more detail on what these commands do, refer to the update-rc.d manpage.

See also