Open source software security

Bypassing Linuxconf in Mandrake

30 November -0001
March 20, 2003

If you have used Mandrake (or most any Linux distribution) for any time you've become familiar with the great utility Linuxconf. Linuxconf is installed by default on a Mandrake system and can be used for a score of configuration related tasks. Check out the Linuxconf homepage for more details.You can usually find linuxconf in the /bin directory of your machine. If you don't have it, feel free to download the latest RPM from RPMfind.net or any one of the mirrors found at Mandrake Linux.

Linuxconf Configuration Tool

One of the most useful functions in linuxconf is the 'Control Panel' that allows you to 'Control Service Activity'. This will give you a handy list of all the services currently running on your computer. Selecting any of the services will allow you to change its configuration and even stop, start, or restart the service. This is extremely handy for restarting daemon services after you've made a configuration change (adding yet another host to /etc/mail/access to deny messages received by sendmail from a spam domain for instance). The services display, however, is a little laggy and it takes time to start it up when you fire up linuxconf. If you examine the output when you stop or start a service, you'll notice it is firing off shell commands to execute these functions. You can easily do this by hand if you want, however, and bypass linuxconf.

The most common way to restart a service is to find the service pid (process id) using the 'ps' command. Issuing 'ps -aux' will show you all the services and their process id numbers. If you're looking for a specific process you can use the 'grep' utility to make your job easier. For instance, if you're looking to restart apache you can issue:

# ps -aux | grep 'httpd'

which should give you an output like this:

root      1707  0.0  1.0 44636 4220 ?        S    Mar18   0:00 httpd -DHAVE_PHP4

Once you've found the process id (in this case 1707) you can restart the process using:

#kill -HUP 1707

and this will restart the process. However, if you want to mimic linuxconf exactly you can actually do the same thing linuxconf does. Change into the /etc/rc.d/init.d directory and take a look at what is there. You should see a lot of different listings, including a listing for the http daemon (httpd) if you've got a web server running. You can stop the server using:

#./httpd stop

or start or restart the service by replacing 'stop' with 'start' or 'restart'. This is exactly what linuxconf does, but by doing it by hand you can manually watch for any errors or lags without linuxconf interfering. YOu can do this even if you don't have linuxconf to mimic the functionality of linuxconf. Try doing this with any of the listings in the /etc/rc.d/init.d directory. Hope this helps ;) Enjoy all.