“In any Linux distribution, some services are enabled to start at boot up by default. For example, on my machine, I have pcmcia, cron daemon, postfix mail transport agent, just to name a few, which start during boot up. Usually, it is prudent to disable all services that are not needed as they are potential security risks and also they unnecessarily waste hardware resources. For example, my machine does not have any pcmcia cards so I can safely disable it. Same is the case with postfix which is also not used. So how do you disable these services so that they are not started at boot time?”
Redhat methods are the easiest here, especially “service pcmcia stop” and “service httpd start”.
But REMEMBER that you have to type “/sbin” before “service” like this “/sbin/service sound stop”, to really work on RHEL distros. I personally use the GUI tool which is amazing because it lists the services available and which one is enabled and which one is not, besides it gives you complete description on each service and what it is its function.
If you log in to root using ‘su -‘ it will load the root path and you won’t need the path to the service binary. You do know that service $something stop only turns off the service until the next init change right? You need to use chkconfig to completely disable something.
chkconfig $something off
I believe chkconfig is an invention of Sun’s used by Redhat and any other distro that wants to add the proper comments to their run change scripts, nothing specific to any distro there.
There is a nice gui tool to enable/disable boot servces on ubuntu, the name is BootUp Manager.
It can be installed with:
sudo apt-get install bum
There is a nice gui tool to enable/disable boot servces on ubuntu, the name is BootUp Manager.
It can be installed with:
sudo apt-get install bum
Thanks for mentioning this. Actually, it works with any Debian-based system.
disabling postfix might not be such a good idea. it is often installed and configured as a local only mail server used to email system alerts to the root user.
Similar to what Gentoo is, only you point directly to the created initiation files and pass an argument like (for example):
/etc/rc.d/sshd start|stop|restart
You add and remove the services in a list located in the /etc/rc.conf file. Arch Linux uses the same method of operation which is another reason I enjoy Arch Linux.
Here’s a little more information about it:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtun…
In the end though, they are all relatively similar at least in operation sense. I think it’s a somewhat portable skill to have.
In Slackware:
chmod -x /etc/rc.d/rc.sshd
Pretty simple and clean, just uses the built in commands instead of seperate binaries or special scripts.
Use Gentoo and you don’t have to worry about disabling a bunch of services you don’t want after an install.
Yes, because compiling everything (sometimes takes days) is so much quicker than disabling services (normally takes minutes or seconds, and only needs to be done once).
Christ, I understand Gentoo is great and all, but give it a rest.
While I have no fear of the command line/terminal window I find the GUI based tools with each distro to be easy to use. Just stop the service, uncheck the box so its not used during sstart up then click ok. But I can understand the GUI not being an option on servers, in which case this article would apply.
chmod +/-x /sbin/init.d/service name
i don’t “worry” about the services i don’t want. I just disable them in a matter of seconds, with redhat.
Not all init script of FBSD are in /etc/rc.d/
only those considered as “core” system daemons are there.
Majority 3rd party stuff like apache and samba are in /usr/local/etc or in package specific directories. This can be confusing to newbies or lazy lamer who don’t read the man page 😉
Strongest point of cmdline here is its scriptability. e.g. for RH systems
1) to save the current state of you services(so that if some dependecies are bork you can still revert back)
chkconfig –list > services.states
1) dump the service names
chkconfig –list | awk ‘{print $1}’ > services.txt
2) del services you want to turn off from services.txt, save it as services.on . you can check what the service does before making a decision with
rpm -qi `rpm -qf /etc/init.d/$SERVICE_NAME`
3) run a script like this
#!/bin/sh
FILENAME=’services.on’
MODE=’on’
cat $FILENAME |
while read SERVICE_NAME
do
chkconfig –level 345 $SERVICE_NAME $MODE
done
exit
4) repeat 2)3) for services you wanna turn off, just save the config to another file and edit $FILENAME on aforesaid script.
Tada, done. you can use the configuration text file on multiple machines, getting them configured in seconds too.