Newbie question - 403 Forbidden

tpx15:/etc/init.d # ls -l /home
total 8
drwxr-xr-x 2 root root 4096 Jun 30 2004 .
drwxr-xr-x 21 root root 4096 Jan 24 14:22 …

tpx15:/etc/init.d # man adduser
Reformatting adduser(8), please wait…
tpx15:/etc/init.d # useradd nagios -d /home/nagios
useradd: User `nagios’ already exists.
tpx15:/etc/init.d #

thx guys…

Blah…at this point I’d just start over. Remove the nagios user from the /etc/shadow and /etc/passwd files and then run this command:

groupadd nagios
useradd -m -g nagios nagios

Then if you do

ls -l /home

The nagios home directory should show up. But it seems like something’s messed up.

If you decide to do that, note that /etc/shadow is write-protected (for good reason). So, if you delete the line with the nagios user in it, then you’ll need to use

:wq!

To save and exit (the BANG symbol is needed since it’s read-only).

But before you go that, do a

grep nagios /etc/shadow
grep nagios /etc/passwd

To verify that the nagios entries are even there. Otherwire you’re just wasting your time.

man userdel

Oh…I thought I’d read somewhere that there’s no command to remove a user or group like that…or am I remembering that you can’t use a command to remove a user from a group?

sorry but isn’t it enough to create the /home/nagios directory?
cd /home
mkdir nagios

you should need nothing more. the home directory is already defined.

Luca

Sure, it would be. But the fact remains that he should learn how to create a new user in linux and at the same time, create the user’s home directory.
“man” is our friend.

ok, ive gone thorugh and re-added the nagios user - it looks good from that end. the verify (nagios -v) is good.

when going to start nagios I get this:

tpx15:/home # /etc/init.d/nagios restart
Running configuration check…done
Stopping network monitor: nagios
No lock file found in /usr/local/nagios/var/nagios.lock
Waiting for nagios to exit . done.
Starting network monitor: nagios

In browser:

“You don’t have permission to access /nagios/ on this server”

Web Server log:

[Sun Jan 29 20:16:09 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:11:27 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:20:40 2006] [notice] SIGHUP received. Attempting to restart
[Mon Jan 30 10:20:40 2006] [notice] Apache/1.3.29 (Linux/SUSE) configured – resuming normal operations
[Mon Jan 30 10:20:40 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Mon Jan 30 10:20:52 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:20:54 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/

did you add the www-data, httpd or however the apache user is called to the “nagios command” group?

nagios.sourceforge.net/docs/2_0/installing.html
the parts described in the following two sections:
Identify Web Server User
Add Command File Group

Luca

ok, changed the permissions on the nagios file, now no more lock error:

tpx15:/usr/local/nagios/var # /etc/init.d/nagios restart
Running configuration check…done
Stopping network monitor: nagios
Waiting for nagios to exit . done.
Starting network monitor: nagios

restarted web server

pre-flight is good

Now got access web interface

tpx15/nagios/

[Mon Jan 30 10:34:39 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:35:33 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:35:59 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:36:03 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:36:59 2006] [notice] SIGHUP received. Attempting to restart
[Mon Jan 30 10:36:59 2006] [notice] Apache/1.3.29 (Linux/SUSE) configured – resuming normal operations
[Mon Jan 30 10:36:59 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Mon Jan 30 10:37:28 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:37:53 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/

ok, changed the permissions on the nagios file, now no more lock error:

tpx15:/usr/local/nagios/var # /etc/init.d/nagios restart
Running configuration check…done
Stopping network monitor: nagios
Waiting for nagios to exit . done.
Starting network monitor: nagios

restarted web server

pre-flight is good

Now, go to access web interface

ipaddress/nagios/

Forbidden
You don’t have permission to access /nagios/ on this server.

/var/log/httpd/error_log:

[Mon Jan 30 10:34:39 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:35:33 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:35:59 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:36:03 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:36:59 2006] [notice] SIGHUP received. Attempting to restart
[Mon Jan 30 10:36:59 2006] [notice] Apache/1.3.29 (Linux/SUSE) configured – resuming normal operations
[Mon Jan 30 10:36:59 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Mon Jan 30 10:37:28 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/
[Mon Jan 30 10:37:53 2006] [error] [client 10.0.100.92] Directory index forbidden by rule: /usr/local/nagios/share/

No noticeable errors in /var/log/messages
Edited Sun Jan 29 2006, 10:35PM ]

from /var/log/httpd/access_log:

10.0.100.92 - - [30/Jan/2006:10:32:54 -0500] “GET / HTTP/1.1” 200 652
10.0.100.92 - - [30/Jan/2006:10:32:55 -0500] “GET /icons/blank.gif HTTP/1.1” 200 148
10.0.100.92 - - [30/Jan/2006:10:32:55 -0500] “GET /icons/back.gif HTTP/1.1” 200 216
10.0.100.92 - - [30/Jan/2006:10:32:55 -0500] “GET /icons/folder.gif HTTP/1.1” 200 225
10.0.100.92 - - [30/Jan/2006:10:33:07 -0500] “GET /nagios/ HTTP/1.1” 401 484
10.0.100.92 - nagiosadmin [30/Jan/2006:10:33:19 -0500] “GET /nagios/ HTTP/1.1” 401 484
10.0.100.92 - nagiosadmin [30/Jan/2006:10:33:35 -0500] “GET /nagios/ HTTP/1.1” 401 484
10.0.100.92 - - [30/Jan/2006:10:34:32 -0500] “HEAD /nagios/ HTTP/1.1” 401 0
10.0.100.92 - nagiosadmin [30/Jan/2006:10:34:39 -0500] “HEAD /nagios/ HTTP/1.1” 403 0
10.0.100.92 - nagiosadmin [30/Jan/2006:10:35:33 -0500] “GET /nagios/ HTTP/1.1” 403 292
10.0.100.92 - nagiosadmin [30/Jan/2006:10:35:59 -0500] “GET /nagios/ HTTP/1.1” 403 292
10.0.100.92 - nagiosadmin [30/Jan/2006:10:36:03 -0500] “GET /nagios/ HTTP/1.1” 403 292
10.0.100.92 - nagiosadmin [30/Jan/2006:10:37:28 -0500] “GET /nagios/ HTTP/1.1” 403 292
10.0.100.92 - - [30/Jan/2006:10:37:44 -0500] “GET / HTTP/1.1” 200 652
10.0.100.92 - - [30/Jan/2006:10:37:44 -0500] “GET /icons/blank.gif HTTP/1.1” 200 148
10.0.100.92 - - [30/Jan/2006:10:37:44 -0500] “GET /icons/folder.gif HTTP/1.1” 200 225
10.0.100.92 - - [30/Jan/2006:10:37:44 -0500] “GET /icons/back.gif HTTP/1.1” 200 216
10.0.100.92 - nagiosadmin [30/Jan/2006:10:37:53 -0500] “GET /nagios/ HTTP/1.1” 403 292
10.0.100.92 - nagiosadmin [30/Jan/2006:10:41:47 -0500] “GET /nagios/ HTTP/1.1” 403 292

YOu got the lock error because you said to RESTART nagios. But in fact, nagios was not running at all, so therefor “lock not found”. Make sense?

Look at your /etc/httpd/conf/httpd.conf and make sure it has:

DirectoryIndex index.html and maybe others too.
Make sure you followed the docs:
nagios.sourceforge.net/docs/1_0/installweb.html
Did you create a .htaccess file?
Restart apache if you make a change to httpd.conf

snippet from /etc/httpd/httpd.conf file:

DirectoryIndex: Name of the file or files to use as a pre-written HTML

directory index. Separate multiple entries with spaces.

DirectoryIndex index.html

I created a .htaccess file. Its in

/usr/local/nagios/sbin/.htaccess
/usr/local/nagios/share/.htaccess

Here are the contents:

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

[quote=“luca”]did you add the www-data, httpd or however the apache user is called to the “nagios command” group?

nagios.sourceforge.net/docs/2_0/installing.html
the parts described in the following two sections:
Identify Web Server User
Add Command File Group

Luca[/quote]

All been done!
honestly, i have followed all these directions
thanks

:cry:

firewall is running? If so, turn it off.
system-config-securitylevel
will show you if it’s on/off.

permission’s on the .htaccess file are?

Permissions are 777 iin both cases. I noticed the file is owned by root. Not sure if this means anything??

tpx15:/usr/local/nagios/share # ls -l
total 68
drwxrwxrwx 9 nagios nagcmd 4096 Jan 27 10:11 .
drwxrwxrwx 8 nagios root 4096 Jan 24 16:24 …
-rwxrwxrwx 1 root root 109 Jan 25 10:57 .htaccess
drwxrwxr-x 2 nagios nagcmd 4096 Jan 27 10:11 contexthelp
drwxrwxr-x 3 nagios nagcmd 4096 Jan 27 10:11 docs
drwxrwxr-x 3 nagios nagcmd 4096 Jan 27 10:11 images
-rw-rw-r-- 1 nagios nagcmd 658 Jan 27 10:11 index.html
drwxrwxrwx 4 root root 4096 Jan 24 16:24 locale
-rw-rw-r-- 1 nagios nagcmd 2344 Jan 27 10:11 main.html
drwxrwxr-x 2 nagios nagcmd 4096 Jan 27 10:11 media
-rw-rw-r-- 1 nagios nagcmd 26 Jan 27 10:11 robots.txt
-rw-rw-r-- 1 nagios nagcmd 12729 Jan 27 10:11 side.html
drwxrwxr-x 2 nagios nagcmd 4096 Jan 24 16:00 ssi
drwxrwxr-x 2 nagios nagcmd 4096 Jan 27 10:11 stylesheets

tpx15:/usr/local/nagios/share # cd /usr/local/nagios/sbin
tpx15:/usr/local/nagios/sbin # ls -l
total 1812
drwxrwxrwx 2 nagios nagcmd 4096 Jan 30 11:48 .
drwxrwxrwx 8 nagios root 4096 Jan 24 16:24 …
-rwxrwxrwx 1 root root 109 Jan 25 10:56 .htaccess
-rwxrwxr-x 1 nagios nagcmd 165228 Jan 27 10:11 avail.cgi
-rwxrwxr-x 1 nagios nagcmd 164456 Jan 27 10:11 cmd.cgi
-rwxrwxr-x 1 nagios nagcmd 127660 Jan 27 10:11 config.cgi
-rwxrwxr-x 1 nagios nagcmd 182088 Jan 27 10:11 extinfo.cgi
-rwxrwxr-x 1 nagios nagcmd 115404 Jan 27 10:11 history.cgi
-rwxrwxr-x 1 nagios nagcmd 111948 Jan 27 10:11 notifications.cgi
-rwxrwxr-x 1 nagios nagcmd 111852 Jan 27 10:11 outages.cgi
-rwxrwxr-x 1 nagios nagcmd 111628 Jan 27 10:11 showlog.cgi
-rwxrwxr-x 1 nagios nagcmd 165132 Jan 27 10:11 status.cgi
-rwxrwxr-x 1 nagios nagcmd 125676 Jan 27 10:11 statuswml.cgi
-rwxrwxr-x 1 nagios nagcmd 112108 Jan 27 10:11 statuswrl.cgi
-rwxrwxr-x 1 nagios nagcmd 131820 Jan 27 10:11 summary.cgi
-rwxrwxr-x 1 nagios nagcmd 129036 Jan 27 10:11 tac.cg

[quote=“jakkedup”]firewall is running? If so, turn it off.
system-config-securitylevel
will show you if it’s on/off.[/quote]

firewall not enabled.