Sunday, April 25, 2010

How to disable a service in Debian

To disable a service ar runlevel 2 (that is default in Debian), rename its script in /etc/rc2.d directory so that the new name begins with a 'K' and a two-digit number, where the number is the difference between the two-digit number following the 'S' in its current name, and 100. To re-enable the service, rename the script back to its original name beginning with 'S'.
mv /etc/rcS.d/S05bootlogd /etc/rcS.d/K95bootlogd
mv /etc/rcS.d/S43portmap /etc/rcS.d/K57portmap
mv /etc/rcS.d/S44nfs-common /etc/rcS.d/K56nfs-common
mv /etc/rcS.d/S70x11-common /etc/rcS.d/K30x11-common

mv /etc/rc2.d/S12acpid /etc/rc2.d/K88acpid
mv /etc/rc2.d/S20nfs-common /etc/rc2.d/K80nfs-common
mv /etc/rc2.d/S20openbsd-inetd /etc/rc2.d/K80openbsd-inetd
mv /etc/rc2.d/S23ntp /etc/rc2.d/K77ntp
mv /etc/rc2.d/S89atd /etc/rc2.d/K11atd
mv /etc/rc2.d/S99stop-bootlogd /etc/rc2.d/K01stop-bootlogd
The other way is to use rcconf or update-rc.d tool
rcconf --off my-service-name
update-rc.d my-service-name disable
Read more about different services here.

No comments :

Post a Comment