Archive for the ‘Linux Services Details’ category

How to determine which sevices are enabled at boot time in linux

November 24th, 2010

How do I find out which services are enabled at Boot under Ubuntu/CentOS/RHEL/Fedora Linux? How can I disable a service which is not needed or I dont want to run every time the linux machine starts?

Open terminal and login as root user.

Type the following command to list all services which are enabled at boot:
#chkconfig –list | grep $(runlevel  | awk ‘{ print $2}’):on

Sample output:
?
acpid             0:off  1:off 2:off 3:on  4:on  5:on  6:off
anacron           0:off 1:off 2:on  3:on  4:on  5:on  6:off
atd               0:off 1:off 2:off 3:on  4:on  5:on  6:off
auditd            0:off 1:off 2:on  3:on  4:on  5:on  6:off
cpuspeed          0:off 1:on  2:on  3:on  4:on  5:on  6:off
crond             0:off 1:off 2:on  3:on  4:on  5:on  6:off
dkms_autoinstaller   0:off 1:off 2:on  3:on  4:on  5:on  6:off
haldaemon         0:off 1:off 2:off 3:on  4:on  5:on  6:off
hidd              0:off 1:off 2:on  3:on  4:on  5:on  6:off
irqbalance        0:off 1:off 2:on  3:on  4:on  5:on  6:off
kudzu             0:off 1:off 2:off 3:on  4:on  5:on  6:off

The first column of above output is the name of a service which is currently enabled at boot. You need to review each service.

How to Disable services

To stop service, enter:

# service {service-name} stop
# service vmware stop

To disable service, enter:

# chkconfig {service-name} off
# chkconfig vmware off

You may also use ‘ntsysv’ command to manage all services.

How run script as simple user during booting time

October 20th, 2010

I have script which start some process but it need to login as user manoj because this script user home path /home/manoj/bin/manojprocess start

But i want to run this process automatically during the booting time but if i run it as root, my process will create some problem. So i have done following things

/etc/init.d/manojprocess
#!/bin/bash
su -c “/home/manoj/bin/manojprocess $1″ – manoj

and added the above script /etc/init.d/manojprocess into /etc/rc.local because /etc/rc.local will run after finishing init processes.

/etc/rc.local

# Start Manojprocess during booting time as Manoj user
/etc/init.d/manojprocess start

The -c Option with su command

Among the most commonly used of su’s few options is -c, which tells su to execute the command that directly follows it on the same line. Such command is executed as the new user, and then the terminal window or console from which su was run immediately returns to the account of the former user after the command has completed execution or after any program that it has launched has been closed.

If the command inclusive of its options has one or more spaces in it, then it must be enclosed in quotation marks; otherwise, su will interpret whatever comes after the first space in the command as the name of a user to whose account su is supposed to switch (the result of which will be an error message).

For example, the /root directory (i.e., the home directory of the root user) is generally not accessible to ordinary users, and thus the command ls /root will return a permission denied error message if it is issued by an ordinary user. However, the contents of this directory can be viewed (assuming, of course, that the correct password is supplied) by using su together with the ls command (which lists the contents of directories) as follows:

su -c "ls /root"

Either double or single quotation marks can be used. And a new user can be explicitly designated along with the command. For example, the following command switches to user bob’s account and produces a list of the contents of bob’s home directory (whose contents would not generally be viewable by other ordinary users):

su -c 'ls /home/manoj' - manoj

su together with its -c option can also be used to launch GUI (graphical user interface) programs. For example, it can be used to start Nautilus (a popular GUI file manager) with root access:

su -c nautilus

Nautilus can be a very handy alternative to the command line for navigating around the system. Root access makes all files and directories on the system available with Nautilus, whereas starting Nautilus as an ordinary user would make only a limited subset of files and directories available. Again, however, it should be emphasized that along with this power comes danger, and thus Nautilus should be used as root only under carefully controlled circumstances.

When a command is issued using su with its -c option, the console or terminal window session generally reverts back to the previous user as soon as the command has executed. This can be viewed as another built-in safety mechanism, because root (or any other substitute user) was apparently used just for a specific command, and thus it would presumably serve no purpose (and just be a security hole) to maintain the new ownership after the program terminated.

However, if the command that has been executed using su and its -c option has opened a program (e.g., Nautilus), that program remains open with the new owner’s (e.g., root’s) privileges until such program is explicitly closed. But the terminal window used to open the program cannot be used for other root operations while the program is running, and ownership of the session in the terminal window reverts back to the former user after the program is terminated.

One minor disadvantage of issuing commands by using the -c option with su, rather than just using su by itself (or using it together with a user name) to first change ownership of a login session, is that command line completion does not work with it. Command completion is a convenient feature of bash and some other shells that automatically completes the typing of a command name or a file name after only part of it has been typed and when the user then presses the TAB key. If su is used by itself to first switch ownership of the terminal session, command completion can then be used for subsequent commands as usual.

Services Descriptions

October 31st, 2009

avahi-daemon (avahi-daemon – The Avahi mDNS/DNS-SD daemon)

bluetooth (We can disabled this, as we are using Bluetooth in the server )

cups (Common UNIX Printing Solution. It is one system the computer uses to control the print queue,Leave it on if you have a printer)

ip6tables (iptables6 is part of the Linux Firewall. Leave it on if you are on a network, especially if you are connected to the world wide web. I think we can disable iptables6)

iptables (iptables is part of the Linux Firewall. Leave it on if you are on a network, especially if you are connected to the world wide web. I think we can disable iptables)

irqbalance (Daemon to balance irq’s across multiple CPUs. Only useful on SMP systems (more than one processor)

isdn (ISDN deamon for ISDN connections. Not needed unless you connect to the net through ISDN.)

mcstrans (Mcstrans is the translation daemon used on computers with SELinux enabled to translate program context into human-readable form. SELinux (Security Enhanced Linux) is a feature of the Linux kernel and a number of utilities with enhanced security functionality designed to add mandatory access controls to Linux. we don’t need this)

irda (Infra Red Data Association. Unless you are doing IR, we don’t need this)

messagebus (D-BUS is first a library that provides one-to-one communication between any two applications; dbus-daemon-1 is an application that uses this library to implement a message bus daemon. Multiple programs connect to the message bus daemon and can exchange messages with one another.)

microcode_ctl (It decodes and sends new microcode to the kernel driver to be uploaded to Intel IA32 processors. (Pentium Pro, PII, PIII, Pentium 4, Celeron, Xeon etc – all P6 and above, which does NOT include pentium classics)

pcscd (The pcscd is used for manage connections to smart card readers. we don’t need this)

xfs (The X font server (xfs) provides a standard mechanism for an X server to communicate with a font renderer, frequently running on a remote machine. It usually runs on TCP port 7100. You need to be running xfs if you want a remote X terminal to be able to use fonts from your system, or if you want to use fonts that your X server doesn’t understand (and the font server does), we don’t need this.

xend (used for virtualization, we can disabled if we are not using the virtualization)

xendomains (used for virtualization, we can disabled if we are not using the virtualization)

rwhod (The rwho protocol lets remote users get a list of all users logged onto a machine by running the rwho daemon.)