LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 10-28-2007, 05:34 PM   #1
honglin_8
LQ Newbie
 
Registered: Oct 2007
Posts: 3
Thanked: 0
"Forbidden / You don't have permission to access /~user/index.html on this server."


[Log in to get rid of this advertisement]
Hi,

I am new to Apache and I received a "Forbidden / You don't have permission to access /~user/index.html on this server." error

The OP is Fedora 7
Apache is 2.2.6

Permissions of all directories and files are set to rwxr-xr-x leading from /home all the way to the files inside public_html.

I have modified the httpd.conf file to make sure it looks for the /~user/public_html directory.

I did not touch any other file or area.
If I "killall httpd" and run /usr/sbin/httpd, then the index.html under the /~user/public_html displays. That means that it seems workd for my purpose.

However, after I run "/etc/init.d/httpd restart", it displayed stopping httpd [ok] starting httpd [ok], but I will not be able to see my index.html file under the /~user/public_html

The system index.html (the testing page) always worked.

May you help me?

Thanks in advance.

Hong
honglin_8 is offline  
Tag This Post , ,
Reply With Quote
Old 10-28-2007, 09:56 PM   #2
jessica_lilly
Member
 
Registered: Oct 2007
Location: England
Distribution: Ubuntu (hardy) and Suse 10.3
Posts: 133
Thanked: 0
are you running the user as root if u can acsess shell type:
su root

and then your root password
jessica_lilly is offline     Reply With Quote
Old 10-29-2007, 12:38 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 8.04 (upgraded from 6.06), Ubuntu Netbook Remix 9.04
Posts: 2,741
Thanked: 87
As /etc/init.d/httpd restart does not work, and /usr/sbin/httpd does work, I suggest that you check the differences between the two ways you start. There might be a different config that is in use or something else.
Wim Sturkenboom is offline     Reply With Quote
Old 10-29-2007, 01:41 PM   #4
honglin_8
LQ Newbie
 
Registered: Oct 2007
Posts: 3
Thanked: 0

Original Poster
Thanks for your reply

Quote:
Originally Posted by jessica_lilly View Post
are you running the user as root if u can acsess shell type:
su root

and then your root password
What do you mean? I have a web page which should be accessed by everyone on the internet. With one way to initiate the httpd, it waoked, and the other way (which is the default way from the boot) it does not work. Yes, I am runnig as root.
honglin_8 is offline     Reply With Quote
Old 10-29-2007, 01:46 PM   #5
honglin_8
LQ Newbie
 
Registered: Oct 2007
Posts: 3
Thanked: 0

Original Poster
More help needed. :)

Quote:
Originally Posted by Wim Sturkenboom View Post
As /etc/init.d/httpd restart does not work, and /usr/sbin/httpd does work, I suggest that you check the differences between the two ways you start. There might be a different config that is in use or something else.

How can I check the difference between the two? One is binary file and the other is text file. I believe the text file calling for the binary file. It should make sense that doen't matter which one, it ended up calling the binary file which is the one it worked. However, the text file did something extra to cause it does not work. Maybe it set up too tight security. I do not understand all the things that the text file is checking. Anyone can explain to me? Here it the text file.

#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0

# check for 1.3 configuration
check13 () {
CONFFILE=/etc/httpd/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read /usr/share/doc/httpd-2.2.6/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

# When stopping httpd a delay of >10 second is required before SIGKILLing the
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
# errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc $httpd -HUP
RETVAL=$?
fi
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL
honglin_8 is offline     Reply With Quote
Old 10-29-2007, 03:58 PM   #6
digen
Member
 
Registered: Dec 2005
Location: India
Distribution: Ubuntu Feisty Fawn
Posts: 107
Thanked: 0
Simple and best way to troubleshoot is to check the Apache error_log.
digen is offline     Reply With Quote
Old 10-29-2007, 05:24 PM   #7
honglin_8
LQ Newbie
 
Registered: Oct 2007
Posts: 3
Thanked: 0

Original Poster
This is the unbeliveable thing ... But still have problems

I was not able to start httpd correctly using
/etc/init.d/httpd restart (which give me stopping [OK] and starting [OK]) All I did is taking out of the lines with # sign and it worked. I mean I can issue /etc/init.d/httpd to see my web now. So both /etc/init.d/httpd and /usr/sbin/httpd worked. However, when I reboot the machine, it doesn't work. What else is wrong???
honglin_8 is offline     Reply With Quote
Old 10-30-2007, 12:28 AM   #8
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 8.04 (upgraded from 6.06), Ubuntu Netbook Remix 9.04
Posts: 2,741
Thanked: 87
Answering your question about the difference between the binary and the script:

/usr/sbin/httpd is a binary (as you stated) and you don't pass any parameters
/etc/init.d/httpd is a script that can pass a number of variables and hence influences the behaviour of apache

I also don't understand everything in the script. One thing that is different when you use the script is the possible call of /etc/sysconfig/httpd. And the fact that you pass $OPTIONS when you start the program.

Regarding the 'new' problem:

Are you sure it is that the script that's called on boot? I think in Fedora it's a symlink in rcX.d (where X is the run level); maybe the symlink points to another file. I don't use Fedora so can not really advice.
Wim Sturkenboom is offline     Reply With Quote
Old 10-30-2007, 09:41 AM   #9
syberguyy
LQ Newbie
 
Registered: Oct 2007
Posts: 7
Thanked: 0
This message is generally caused because either

* The underlying file system permissions do not allow the User/Group under which Apache is running to access the necessary files; or
* The Apache configuration has some access restrictions in place which forbid access to the files.

You can determine which case applies to your situation by checking the error log.

In the case where file system permission are at fault, remember that not only must the directory and files in question be readable, but also all parent directories must be at least searchable (i.e., chmod +x /directory/path) by the web server in order for the content to be accessible.
syberguyy is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forbidden You don't have permission to access / on this server tekmann33 Linux - Software 4 06-16-2009 04:17 AM
403 You don't have permission to access /index.html on this server. xpucto Linux - Networking 6 06-06-2006 10:19 AM


All times are GMT -5. The time now is 10:32 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration