Friday 2 May 2014

Frequently Asked Linux Interview Questions



PART-1

  1. How did you install Linux server on your machine.
  2. How do you configure Linux Kick start installation?
  3. What services do you require to share something?
  4. NFS configuration, options……what do you know about root squash?
  5. What protocols are used in NFS?
  6. What are services are required for NFS share to mount on a client.
  7. Tell me something about LVM. How would you know that system in LVM enabled.
  8. How many Raids are you familiar with? Tell me in brief about RAID 1 & 5.
  9. how do you find what RAID on the system in configured.
  10. Tell me about some security aspects about NFS client share.
  11. Have you heard about semaphore?
  12. How would you know about NFS registered services on a machine?
  13. What is port?
  14. What are the differences between TCP & UDP?
  15. In system where is 100% memory utilized, how would you check whether the system has performance issue or not? And what does it indicates to you when the system is showing 100% utilization.
  16. What causes normally the load average to go up?
  17. What are differences between module and kernel?
  18. What is inter-process communication?

PART-2


  1. What is your day to day activity in you current organization.
  2. How can you recognize LUN in your Linux machine?
  3. What is GRUB?
  4. What is difference between regular and General file system
  5. If generals are corrupted in your system, how would you recover them
  6. What are differences among RPM, UP2DATE and YUM.
  7. How will you set kernel parameter? Permanent/Temporary.
  8. how do you check  open files in your system and which kernel parameter is used by kernel parameter.
  9. How do you steup Printer in your system.
  10. How would you check configured Printers in your system?
  11. What is Sticky Bit and where is it by default set in your system
  12. what does TOP command do and what parameter it contains for memory.
  13. Have you worked on Backup Tool like VERITAS Netbackup.
  14. How would you configure backup client on your system.
  15. How would you judge system performance?
  16. How would you check system load average?
  17. How to know CPU is bottlenecked and CPU is HIGH and what remedies would you like to use to overcome this issue.
  18. What is difference between real time and user process?
  19. Tell me about iostat command and its parameter.
  20. What will you give solution about HIGH I/O wait is your machine.
  21. How can you design Hardware configuration (Dev/Test/Prod).
  22. Why we use default gateway in your system.
  23. Tell me some applications which use TCP/UDP protocols.
  24. How will you troubleshoot if use is not able to login in Linux machine
  25. How can you lock and unlock user in Linux.
  26. What cluster services are used in Linux cluster?
  27. How can you check commands run by last user.
  28. How can you partition in Linux system at run time.
  29. What is use of partprobe command in Linux?
  30. How will you setup ssh pass-through.
  31. What is usage of passphrase?
  32. What is difference between grep and find.
  33. How will you find out a particular string in a file by using grep and find.
  34. What is usage of redirection operator (> & >>).
  35. Shell Scripting----- $$, $! ,$@, $0,$?
  36. How can you pass argument to script.


PART-3

  1. How can you configure Linux virtual machine?
  2. How can you check xen enabled kernel and OS?
  3. What would be effect if grub not in OS.
  4. How to upgrade kernel in Linux machine.
  5. What is RPM and what are usage if –U and –F options with rpm command.
  6. what are zombie processes and how can you detect them into your system
  7. How can you kill zombie processes?
  8. What is the usage of nslookup command?
  9.  where can you set priority for resolving naming resolution in Linux machine.(nsswitch.conf)
  10. How can you find out whether system is NIS enabled or not.
  11. What is difference between CRON and AT.
  12. What is swap and when we use it.
  13. Command to check swap in your system.
  14. What is daemon?
  15.  What are the daemons used for logs in Linux.
  16.  What is HARD and SOFT link and why we use them?
  17. How to check inode in your sysem.
  18. Why we use lsof.
  19. What is superblock and inode
  20. what is usage of modprob.conf.
  21. How can load and unload modules in your system.
  22. How can you share data through NFS.
  23. What is PXE and how will you setup it.
  24. What is subnet mask?
  25. How can you boot Linux machine in single use mode.
  26. How can you check the type of file system without mounting them?



PART-4

  1. What is heartbeat
  2. How can you reset group password.
  3. How can you encrypt the group password.
  4. How can you create script to run specific command on 1000 boxes.
  5. Do you know about Veritas cluster?
  6. How can you rename volume group.
  7. What is difference between apache1.3 and apache2.0
  8. How can you compile the kernel?
  9. How can you reload NFS configuration file without restating services.
  10. How can you temporary share NFS without making entry into /etc/exports?
  11. What is multipath and how can you configure it for different Storage.
  12. What is bonding and what is use of it.
  13. How can you check the file system?
  14. How will you extend and reduce LVM.
  15.  What is NFS Stale?
  16. How will you troubleshoot if kernel is panic after up gradation?
  17. What is ARP and what is its use.
  18. What are major and minor numbers?
  19. Tell me about different type of files in Linux and give some example of block and character devices.
100.    How can you change nice value of process?



    

Wednesday 30 April 2014

NFS Stale File Handle Error and Solution


Sometime NFS can result in to weird problems. For example NFS mounted directories sometimes contain stale file handles. If you run command such as ls or vi you will see an error:
$ ls
.: Stale File Handle

NFS Stale:
A file handle becomes stale whenever the file or directory referenced by the handle is removed by another host, while your client still holds an active reference to the object. A typical example occurs when the current directory of a process, running on your client, is removed on the server (either by a process running on the server or on another client).

How do I fix this problem?

a) The best solution is to remount directory from the NFS client using mount command.
umount -f /mnt/local
# mount -t nfs nfsserver:/path/to/share /mnt/local

Difference between Samba and CIFS


SAMBA was originally SMB Server - but the name had to be changed due to SMB Server being an actual product. SMB was the predecessor to CIFS. SMB "server message block" and CIFS "common internet file system" are protocols. Samba implements CIFS network protocol. This is what allows Samba to communicate with (newer) MS Windows systems. Typically you will see it referred to SMB/CIFS. However, CIFS is the extension of the SMB protocol so if someone is sharing out SMB via Samba to a legacy system still using NetBIOS it will typically connect to the Samba server via port 137, 138, 139 and CIFS is strictly port 445

Tuesday 29 April 2014

How to extract the RPM package


We can extract the content of RPM package first into cpio archive using utility rpm2cpio on standard output. if a – argument is given using cpio command, an rpm stream is read from standard in. The syntax is as follows.

SYNTAX:

$ rpm2cpio <RPM package> | cpio –idvm

Example:  

[root@syncsrv01 jitendrakumar]# ls -ltr
total 292
-rw-------. 1 jitendrakumar domain admins   1675 Aug 23  2013 ssh_key
-rwxr-xr-x. 1 root          root             879 Nov 26 15:46 root_expir_alert
-rw-r--r--. 1 root          root          290624 Apr 29 15:48 ntfs-3g-2011.4.12- 5.el6.i686.rpm   
                                                                      
[root@syncsrv01 jitendrakumar]# rpm2cpio ntfs-3g-2011.4.12-5.el6.i686.rpm | cpio   -idvm                                                                           
./bin/lowntfs-3g
./bin/ntfs-3g
./bin/ntfs-3g.probe
./bin/ntfs-3g.secaudit
./bin/ntfs-3g.usermap
./bin/ntfsmount
./lib/libntfs-3g.so.81
./lib/libntfs-3g.so.81.0.0
./sbin/mount.lowntfs-3g
./sbin/mount.ntfs
./sbin/mount.ntfs-3g
./sbin/mount.ntfs-fuse
./usr/bin/ntfs-3g
./usr/bin/ntfsmount
./usr/share/doc/ntfs-3g-2011.4.12
./usr/share/doc/ntfs-3g-2011.4.12/AUTHORS
./usr/share/doc/ntfs-3g-2011.4.12/COPYING
./usr/share/doc/ntfs-3g-2011.4.12/CREDITS
./usr/share/doc/ntfs-3g-2011.4.12/ChangeLog
./usr/share/doc/ntfs-3g-2011.4.12/NEWS
./usr/share/doc/ntfs-3g-2011.4.12/README
./usr/share/hal/fdi/policy/10osvendor/20-ntfs-config-write-policy.fdi
./usr/share/man/man8/mount.lowntfs-3g.8.gz
./usr/share/man/man8/mount.ntfs-3g.8.gz
./usr/share/man/man8/ntfs-3g.8.gz
./usr/share/man/man8/ntfs-3g.probe.8.gz
./usr/share/man/man8/ntfs-3g.secaudit.8.gz
./usr/share/man/man8/ntfs-3g.usermap.8.gz
1304 blocks

[root@syncsrv01 jitendrakumar]# ll
total 308
drwxr-xr-x. 2 root          root            4096 Apr 29 15:49 bin
drwxr-xr-x. 2 root          root            4096 Apr 29 15:49 lib
-rw-r--r--. 1 root          root          290624 Apr 29 15:48 ntfs-3g-2011.4.12-5.el6.i686.rpm
-rwxr-xr-x. 1 root          root             879 Nov 26 15:46 root_expir_alert
drwxr-xr-x. 2 root          root            4096 Apr 29 15:49 sbin
-rw-------. 1 jitendrakumar domain admins   1675 Aug 23  2013 ssh_key
drwxr-xr-x. 4 root          root            4096 Apr 29 15:49 usr


The extracted rpm data are

bin lib  sbin user

Note:
In this example, output of rpm2cpio command piped to cpio command with following options:
§  i: Restore archive
§  d: Create leading directories where needed
§  m: Retain previous file modification times when creating files
§  v: Verbose i.e. display progress


Security Modes/Type in Samba Setup in Linux

If you have read any of the Samba content  you probably will have noticed that within the smb.conf configuration file a line that begins with security =. This is a very important part of Samba setup and generally the section that gives users the most problems. Although the security mode would seem fairly straight-forwardit is certainly worth explaining.
In this article I will discuss what the security mode feature does and what the different modes are. By the end of this article there should be no confusion as to which mode your Samba setup should use.
What are security modes?
I like to think of security modes as a means to inform the server just how a client will authenticate. You know about authentication from many sources. You can authenticate at a local level, as part of a domain, using Active Directory, and more. How you authenticate is generally dictated by your IT department (or by yourself if you are personal or home user). Because of the different types of authentication, Samba needs a way to know how this authentication is going to happen.
Now, from a Windows perspective (and the reason why Samba exists) there are only two types of security level: Share level and User level. But because Windows has multiple ways of authentication Samba needs to break the user level down further. So, as far as Samba is concerned, these levels are called modes and there are five modes: user, share, domain, ADS, and server. Let's take a look at each of these.
user
The security = user mode is really the easiest to understand. From the Samba server perspective, the only things that matter (with regard to user mode) is username/password and the name of the client machine. This mode works very simply: If the Samba server accepts the username/password of the client then that client is able to mount shares on the server.
share
The security = share mode the client will authenticate itself against a share on the Samba server. Unlike user, when security = shareauthenticates against a share, that means that client only has access to that share. When using this mode the client sends a password along with each share request. If the password authenticates, the client has access to the share. If not, no access is granted. The authentication process is like this:
1.    The client sends a session setup request that includes a valid username.
2.    Samba records this username.
3.    Client issues a tree connection request and the share the client wishes to connect with.
4.    The users password is the then checked against the username. If password matches, the client is given access.
domain
The security = domain provides a means for storing all username/passwords in a centralized, shared account. This account is then shared between domain controllers. So when Samba uses this mode of security it has a domain security trust account and forces all authentication requests to be passed through the domain controller. When using this mode the configuration requires a second parameter. So the configuration will look like:
security = domain
workgroup = DOMAIN_NAME
You also have to join the domain using the net rpc join -U ADMINISTRATOR%PASSWORD command. Where ADMINISTRATOR is the name of the administrator account and PASSWORD is the password for that account.
ads
As you might expect, this is the Active Directory mode. Samba added ADS functionality at release 3. Using ADS mode is only possible if the Active Directory server is run in native mode. When running in ADS mode Samba will need NT-compatible authentication data - in other words Kerberos. So your Samba server will need to have a working Kerberos system installed. When using ADS mode, your Samba configuration adds another line like so:
realm = YOUR.KERBEROS.REALM
security = ADS
server
The last mode is security = server. This mode is generally not used any more because it basically sends username/password authentication to another machine. If this other machine is down, there will be no authentication. This mode presents numerous problems, which is why it is often not used. One of the more serious problems is that once a connection to the password server is made, that connection can be left open for extended periods of time - thus a severe security issue.


Append files to an Archive TAR file


The simplest way to append the files into existing archive is the “--append” or “-r” operation using tar command.

Syntax:
tar –rvf <Tar Archived File>  <filename>
OR
tar –append –file=< Tar Archived File>  <filename>

Example1:
Here we are adding filename “five” into archive file “test.tar”.

[root@mail01 jitendrakumar]# tar -rvf test.tar five
five
 [root@mail01 jitendrakumar]# tar -tvf test.tar
-rw-r--r-- root/root         0 2014-04-29 10:58 two
-rw-r--r-- root/root         0 2014-04-29 10:58 three
-rw-r--r-- root/root         0 2014-04-29 10:58 foure
-rw-r--r-- root/root         0 2014-04-29 10:58 one
-rw-r--r-- root/root         0 2014-04-29 10:59 five

Example2:
 Here we are adding filename “six” into archive file “test.tar”.

[root@mail01 jitendrakumar]# tar --append --file=test.tar six
[root@mail01 jitendrakumar]# tar -tvf test.tar
-rw-r--r-- root/root         0 2014-04-29 10:58 two
-rw-r--r-- root/root         0 2014-04-29 10:58 three
-rw-r--r-- root/root         0 2014-04-29 10:58 foure
-rw-r--r-- root/root         0 2014-04-29 10:58 one
-rw-r--r-- root/root         0 2014-04-29 10:59 five
-rw-r--r-- root/root         0 2014-04-29 11:06 six



Monday 28 April 2014

List the content of tar, tar.gz and tar.bz2 compressed files

tar is an archiving program designed to store and extract files from an archive file known as a tarfile. You can create a tar file or compressed tar file tar. However sometime you need to list the contents of a tar or tar.gz file on screen before extracting the all files. Following commands will help you to view the content of tarfile.



  • To list the content of tar file.

            # tar –tvf  file.tar


  • To list the content of a tar.gz file.

            # tar –ztvf  file.tar.gz



  •  To List the content of a tar.bz2 file.
# tar –jtvf file.tar.bz2

Where:

§  t: List the contents of an archive
§  v: Verbosely list files processed (display detailed information)
§  z: Filter the archive through gzip so that we can open compressed (decompress) .gz tar file
§  j: Filter archive through bzip2, use to decompress .bz2 files.
§  f filename: Use archive file called filename



Wednesday 12 March 2014

How to flush mail queue in sendmail under linux?

How to flush mail queue in sendmail under linux?
If you want to do a one-off queue run:

[root@test ~]#sendmail -q       
It will process each message in the queue and forcefully send the queued mails (add the -v option for logging).

For checking sendmail logs
[root@test ~]#tail -f /var/log/maillog
[root@test ~]#mailq
/var/spool/mqueue is empty
                Total requests: 0
[root@test ~]#vi /var/spool/mqueue            — mail queue

How to flush sendmail queue under linux sendmail mailq command in linux how to flush mail queue in sendmail under linux
If you are worried about sendmail pending mail flush do the following two things.
1) manually method –> delete /var/spool/mail/*.* files in this dir –> delete /var/mqueue/*.* files
then check if all mail gone using mailq command. all mail will be deleted.
2) using command:- use simple command
[root@test ~]#sendmail -v -q                  
use root prompt. it will flush all pending mails. Rest to confirm u can run mailq command if all are really gone !!….
3) if u want particular domain or user or recipient mail to delete use this command
[root@test ~]#sendmail -qS -v test.com
it will delete all mail from *@test.com
[root@test ~]#sendmail -qR -v hotmail.com                 

 It will delete all mail from recipient of hotmail.com.

Thursday 16 January 2014

Step by Step Nagios Installation and Configuration


Nagios is an awesome Open Source monitoring tool, its provides you more comprehensive monitoring environment to always keep an eye on your all machines / networks whether you are in  your data center or just your small labs.

With Nagios, you can monitor your remote hosts and their services remotely on a single window. It shows warnings and indicates if something goes wrong in your servers which eventually helps us to detect some problems before they occur. It helps us to reduce downtime and business losses.

This tutorial explains how to install and configure the Nagios tool on Linux. I am using RHEL 5.8 for installation Nagios.
Before installation of Nagios some prerequisites are required to resolve the dependencies of Nagios.
1.    Install required dependencies:
During portions of the installation you'll need to have root access to your machine.
Make sure you've installed the following packages on your RHEL5.8 installation before continuing installation of Nagios 4.0.1.
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries
You can use yum default package installer to install these packages by running the following commands (as root):
[root@RHEL5 ~]#yum install httpd php
[root@RHEL5 ~]#yum install gcc glibc glibc-common
[root@RHEL5 ~]#yum install gd gd-devel
[root@RHEL5 ~]#yum install make net-snmp

2.    Create Nagios user and Group:

[root@RHEL5 ~]# useradd nagios
[root@RHEL5 ~]# passwd nagios
Changing password for user nagios.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

[root@RHEL5 ~]# groupadd nagcmd
[root@RHEL5 ~]# /usr/sbin/usermod -a -G nagcmd nagios
[root@RHEL5 ~]# /usr/sbin/usermod -a -G nagcmd apache

3.    Download Nagios Core 4.0.1 and Nagios Plugin 1.5
Create a directory for your Nagios installation and all its future downloads.
[root@RHEL5 ~]# mkdir /root/downloads
[root@RHEL5 ~]# cd /root/downloads

Now download latest Nagios Core 4.0.1 and Nagios plugins 1.5 packages with wget command.


4.    Extract Nagios Core and its Plugins:

We need to extract the downloaded packages with tar command.

[root@RHEL5 downloads]# tar -xzvf nagios-4.0.1.tar.gz
[root@RHEL5 downloads]# tar -xzvf nagios-plugins-1.5.tar.gz

When you extract these tarballs with tar command, two new folders will appear in that directory.

[root@RHEL5 downloads]# ls -ltr
total 4060
drwxr-xr-x 15 root root    4096 Oct  2 20:57 nagios-plugins-1.5
drwxrwxr-x 18  root root    4096 Oct 16 05:06 nagios-4.0.1
-rw-r--r--  1   root root 1695367 Oct 16 05:19 nagios-4.0.1.tar.gz
-rw-r--r--  1    root root 2428258 Jan 16  2014 nagios-plugins-1.5.tar.gz

5.    Configure Nagios Core:

i)                  Now, first we will configure Nagios Core and to do so we need to go to Nagios directory and run configure file and if everything goes fine, it will show the output in the end as sample output. Please see below

[root@RHEL5 downloads]# cd nagios-4.0.1
[root@RHEL5 nagios-4.0.1]# ./configure --with-command-group=nagcmd


Sample Output:

*** Configuration summary for nagios 4.0.1 10-15-2013 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  ${prefix}/var/nagios.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/rc.d/init.d
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /bin/traceroute

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.


ii)           Now, after configuring we need to Compile and install all the binaries with make command and make install command will install all the needed libraries in your machine and we can proceed further.

[root@RHEL5 nagios-4.0.1]# make all
[root@RHEL5 nagios-4.0.1]# make install

Sample Output:

*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install-init
     - This installs the init script in /etc/rc.d/init.d

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs sample config files in /usr/local/nagios/etc

make[1]: Leaving directory `/root/downloads/nagios-4.0.1'

iii)          Following command will install the init scripts for Nagios.

[root@RHEL5 nagios-4.0.1]# make install-init
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios

*** Init script installed ***

iv)          To make nagios work from command line we need to install command-mode.

[root@RHEL5 nagios-4.0.1]# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw

*** External command directory configured ***

v)           Next, install sample nagios files, please run following command.

[root@RHEL5 nagios-4.0.1]# make install-config

6.    Customizing Nagios Configuration:

Open the “contacts.cfg” file with your choice of editor and set the email address associated with the nagiosadmin contact definition to receiving email alerts.

[root@RHEL5 ~]# vi /usr/local/nagios/etc/objects/contacts.cfg

##############################################################################
 CONTACTS
##############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
        contact_name          nagiosadmin             ; Short name of user
        use          generic-contact    ; Inherit default values from generic-contact template (defined above)
        alias        Nagios Admin            ; Full name of user

        email  jitendrakumaryogi@gmail.com    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

7.    Install and configure Web Interface for Nagios:

We are done with all configuration in the backend, now we will configure Web Interface for Nagios with following command. The below command will Configure Web interface for Nagios and a web admin user will be created “nagiosadmin”.

[root@RHEL5 nagios-4.0.1]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

*** Nagios/Apache conf file installed ***

In this step, we will be creating a password for “nagiosadmin”. After executing this command, please provide a password twice and keep it remember because this password will be used when you login in the Nagios Web interface.

[root@RHEL5 nagios-4.0.1]# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

[root@RHEL5 nagios-4.0.1]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

8.    Compile and Install Nagios Plugin:

We have downloaded nagios plugins in /root/downloads, Go there and configure and install it as directed below.

[root@RHEL5 nagios-4.0.1]# cd /root/downloads/
[root@RHEL5 downloads]# cd nagios-plugins-1.5
[root@RHEL5 nagios-plugins-1.5]#./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@RHEL5 nagios-plugins-1.5]# make
[root@RHEL5 nagios-plugins-1.5]# make install

9.    Verify Nagios configuration file:

Now we are all done with Nagios configuration and its time to verify it and to do so please insert following command. If everything goes smooth it will show up similar to below output.

[root@RHEL5 nagios-plugins-1.5]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

10.  Add Nagios Services to System Startup:

To make Nagios work across reboots, we need to add nagios and https with chkconfig command.

[root@RHEL5 nagios-plugins-1.5]# chkconfig --add nagios
[root@RHEL5 nagios-plugins-1.5]# chkconfig --level 35 nagios on
[root@RHEL5 nagios-plugins-1.5]#  chkconfig --add httpd
[root@RHEL5 nagios-plugins-1.5]# chkconfig --level 35 httpd on

Restart Nagios to make the new settings take effect.

[root@RHEL5 nagios-plugins-1.5]# service nagios start
nagios is stopped
Starting nagios:                                           [  OK  ]

11.  Modify SELinux Settings:
RedHat ships with SELinux (Security Enhanced Linux) installed and in Enforcing mode by default. This can result in "Internal Server Error" messages when you attempt to access the Nagios CGIs. See if SELinux is in Enforcing mode.
            [root@RHEL5 nagios-4.0.1]# getenforce
Put SELinux into Permissive mode.
            [root@RHEL5 nagios-4.0.1]# setenforce 0

To make this change permanent, you'll have to modify the settings in /etc/selinux/config and reboot.
Instead of disabling SELinux or setting it to permissive mode, you can use the following command to run the CGIs under SELinux enforcing/targeted mode:

[root@RHEL5 nagios-4.0.1]# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
[root@RHEL5 nagios-4.0.1]# chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

12. Login to Nagios Web Interface:


Your nagios is ready to work, please open it in your browser with “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and provide the username “nagiosadmin” and password.

Nagios Login