Understanding services and daemons

On UNIX systems, system services are handled by server programs, which are usually called daemons. One advantage of a daemon is that it does not require that a user be logged on to perform its tasks.

Windows has its own server-level programs, which are called services. Unlike a daemon, a service logs on to the computer with a user account. This allows the administrator greater control over the privileges granted the service and, when the service logs on with a domain account, even allows the service to access network resources.

Interix lets you take advantage of both of these mechanisms to provide services such as inetd, which is a "super-server" for Internet services.

The default mechanism is to run such services as traditional UNIX daemons. To provide for this, Interix uses the init(1) utility to start and stop these daemons. Much like when a traditional UNIX system boots, the Interix subsystem runs init(1) as part of its startup procedure. This utility executes scripts referenced by symbolic links located in /etc/rc2.d when it starts. It then continues to run until it receives a signal indicating it should terminate, when it runs shutdown scripts for daemons it had started. For more information about the startup and shutdown process, see init(1).

Interix programs designed to run as daemons can be controlled using the usual UNIX mechanisms, such as by sending it signals using the kill(1) utility.

To support running Interix programs as Windows services, Interix has a program called service(1) that administers Interix services. The service program registers, installs, starts, and stops an Interix program that is running as a service.

Services use the program psxrun.exe, which Windows Services for UNIX setup installs into the Windows system32 directory. Two daemons-as-services, inetd(1), and syslogd(1), are also provided.

Windows includes the Service Control Manager, which starts with Windows and runs in the background, handling services on behalf of the operating system. Services are either automatic, which means they are started on system startup, or manual, which means they are started by the user.

Services are controlled through the Services administration utility. You can use this utility to add, remove, view, start, and stop services.

For security reasons, each running service is affiliated with a user and a password and has its own unique identification number. Most services are associated with the user, Local System, which was designed for running services and does not require a password. Information on each service is available in the registry, but this information is usually invisible to the user.

For you to run a service, your user account must be assigned the service logon right. This privilege is automatically given to your account the first time you start or install a service using the Interix service utility. It is possible, however, for the Administrator to remove this right from a user account to prevent it from running services.

A service has no console display. You cannot send a signal to a service using the kill(1) utility. You can stop it in Windows by opening Services, or by using the service utility in Interix.

A service runs in a minimal environment, which consists of the environment assigned to the system’s default user, and the TZ environment variable. Its standard input, output, and error are all redirected to /dev/null.