LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-22-2011, 01:05 PM   #1
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Rep: Reputation: 15
Forbidden (/var/www/directory access error)


I am trying to browse in /var/www/directory and it giving me a following error.

Forbidden

You don't have permission to access /directory/ on this server.
Apache/2.2.14 (Ubuntu) Server at localhost Port 80


I have just copied that directory to /var/www.
What might be wrong.

Thank you
amritpalpathak.blogspot.com
 
Old 07-22-2011, 01:09 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Check the permissions on that directory
Code:
ls -ls /var/www
will show you permissions and directory ownership.
 
Old 07-22-2011, 01:14 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by amritpalpathak View Post
I am trying to browse in /var/www/directory and it giving me a following error.

Forbidden
You don't have permission to access /directory/ on this server.
Apache/2.2.14 (Ubuntu) Server at localhost Port 80

I have just copied that directory to /var/www.
What might be wrong.
Hmm...could be that You don't have permission to access that directory, just like the error message says. Check the permissions/ownership of the directory.

Last edited by TB0ne; 07-22-2011 at 01:20 PM.
 
Old 07-23-2011, 07:15 AM   #4
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
I am download this directory by a script and then copying it to /var/www .So i have already changed the permisson of /var/www as:

sudo chmod 777 -R /var/www/

Is it the cause for error?

Thanks
amritpalpathak.blogspot.com
 
0 members found this post helpful.
Old 07-23-2011, 07:59 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by amritpalpathak View Post
I am download this directory by a script and then copying it to /var/www .So i have already changed the permisson of /var/www as:

sudo chmod 777 -R /var/www/

Is it the cause for error?
No idea, since (again), you don't provide details. You don't say anything about the script, what it does, how it downloads WHAT, from WHERE, or where you have your document root directory set up. What user ID does apache run as? What were the permissions on the /var/www tree before you changed them? What are you trying to accomplish? And did you try to look this error up??
http://defindit.com/readme_files/apache_13_error.html

Also, doing a chmod 777 on ANYTHING is a bad idea...doing it to anything related to a network-related resource is even WORSE.
 
Old 07-24-2011, 07:58 AM   #6
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
This is script which is doing above things

sudo wget [url]http://server.com/package-name
sudo chmod 777 -R /var/www/
sudo mv GNDEC-SMS-Service.tar.gz /var/www/
cd /var/www/
sudo tar -zxvf GNDEC-SMS-Service.tar.gz
sudo chmod 777 -R GNDEC-SMS-Service

Then i tried to access "localhost/GNDEC-SMS-Service" and got above error.Thats all

Thanks

amritpalpathak.blogspot.com

Last edited by amritpalpathak; 07-26-2011 at 12:18 PM.
 
0 members found this post helpful.
Old 07-24-2011, 02:18 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by amritpalpathak View Post
This is script which is doing above things

sudo wget http://202.164.53.116/~amritpal/edit...Service.tar.gz
sudo chmod 777 -R /var/www/
sudo mv GNDEC-SMS-Service.tar.gz /var/www/
cd /var/www/
sudo tar -zxvf GNDEC-SMS-Service.tar.gz
sudo chmod 777 -R GNDEC-SMS-Service

Then i tried to access "localhost/GNDEC-SMS-Service" and got above error.Thats all
Ok. Once again, please re-read my previous post, and PAY ATTENTION to what it's saying/asking, and answer the questions.
  • Doing a chmod 777 on a web-exposed directory is a very bad idea, and is unnecessary. Reference the link in my previous post to explain why, and what you SHOULD do. Did you READ that link, and understand it?
  • Where do you have your document root directory set to? Have you actually VERIFIED that the path you're specifying is correct??
  • What user ID does apache run as?
  • What were the permissions on the /var/www tree before you changed them?
  • What are you trying to accomplish?
 
Old 07-24-2011, 02:54 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

Since you still get a 403 error even with a 777 permissions, then I guess this is because you don't have an index page in that directory.
You may enable "Options Indexes" for that specific directory, if you want to be able to browse it.
As TB0ne has already pointed out, it's not good to use 777 for files/directories. The correct permissions for directories is 755 and for files 644

BTW, edit your post above and hide the URL, of the file you download

Regards
 
1 members found this post helpful.
Old 07-26-2011, 12:19 PM   #9
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
@bathory

I am sure index file is present there.My friends can use the same script without any error on there systems.

Thanks

amritpalpathak.blogspot.com
 
0 members found this post helpful.
Old 07-26-2011, 01:01 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
What gives:
Code:
ls -ld /var/www/GNDEC-SMS-Service
ls -l /var/www/GNDEC-SMS-Service
Also check the apache error_log to see why you get that 403 error.
 
Old 07-26-2011, 03:24 PM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by bathory View Post
What gives:
Code:
ls -ld /var/www/GNDEC-SMS-Service
ls -l /var/www/GNDEC-SMS-Service
Also check the apache error_log to see why you get that 403 error.
Yes, I had asked the OP questions like this a few times already, but they've not answered. Perhaps you'll have more luck.
 
Old 08-01-2011, 12:14 PM   #12
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
Sorry i was unavailable for some time.check out output of following command.

ls -ls /var/www
total 3936
4 drwxrwxrwx 10 amrit amrit 4096 2011-07-18 23:30 GNDEC-SMS-Service
3928 -rw-r--r-- 1 root root 4020082 2011-07-18 23:39 GNDEC-SMS-Service.tar.gz.1
4 -rw-r--r-- 1 root root 177 2011-07-28 12:42 index.html


Thanks
amritpalpathak.blogspot.com
 
Old 08-01-2011, 12:36 PM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
So what gives:
Code:
ls -la /var/www/GNDEC-SMS-Service
 
Old 08-01-2011, 09:06 PM   #14
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by amritpalpathak View Post
Sorry i was unavailable for some time.check out output of following command.
ls -ls /var/www
total 3936
4 drwxrwxrwx 10 amrit amrit 4096 2011-07-18 23:30 GNDEC-SMS-Service
3928 -rw-r--r-- 1 root root 4020082 2011-07-18 23:39 GNDEC-SMS-Service.tar.gz.1
4 -rw-r--r-- 1 root root 177 2011-07-28 12:42 index.html
Ok...we already knew this. We have, though, asked several other questions, several times, which you haven't bothered to answer. One more time:
  • Doing a chmod 777 on a web-exposed directory is a very bad idea, and is unnecessary. Reference the link in my previous post to explain why, and what you SHOULD do. Did you READ that link, and understand it?
  • Where do you have your document root directory set to? Have you actually VERIFIED that the path you're specifying is correct??
  • What user ID does apache run as?
  • What were the permissions on the /var/www tree before you changed them?
  • What are you trying to accomplish?
If you're not going to bother to reply to questions asked of you, in order so that others may HELP YOU, then posting isn't of much use.
 
Old 08-02-2011, 02:19 AM   #15
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
it gives

ls -la /var/www/GNDEC-SMS-Service
total 852
drwxrwxrwx 10 amrit amrit 4096 2011-07-18 23:30 .
drwxrwxrwx 3 root root 4096 2011-08-01 22:12 ..
-rwxrwxrwx 1 amrit amrit 4578 2011-07-18 23:25 \
-rwxrwxrwx 1 amrit amrit 6433 2011-07-18 23:25 additionalinfo.php
-rwxrwxrwx 1 amrit amrit 13080 2011-07-18 23:28 address.php
-rwxrwxrwx 1 amrit amrit 4763 2011-07-18 23:24 birthday.php
-rwxrwxrwx 1 amrit amrit 3121 2011-07-18 23:26 cell.php
-rwxrwxrwx 1 amrit amrit 2404 2011-07-18 23:28 changeLog.txt
-rwxrwxrwx 1 amrit amrit 9142 2011-07-18 23:24 class-contactlist.php
-rwxrwxrwx 1 amrit amrit 4596 2011-07-18 23:24 classes.php
-rwxrwxrwx 1 amrit amrit 2458 2011-07-18 23:25 config.php
-rwxrwxrwx 1 amrit amrit 4210 2011-07-18 23:25 constants.inc
-rwxrwxrwx 1 amrit amrit 1473 2011-07-18 23:25 credits.html
drwxrwxrwx 3 amrit amrit 4096 2011-08-01 22:12 css
-rwxrwxrwx 1 amrit amrit 33989 2011-07-18 23:24 datetime.js
-rwxrwxrwx 1 amrit amrit 352 2011-07-18 23:18 DEADJOE
-rwxrwxrwx 1 amrit amrit 24204 2011-07-18 23:24 edit.php
-rwxrwxrwx 1 amrit amrit 36864 2011-07-18 23:24 .edit.php.swp
-rwxrwxrwx 1 amrit amrit 26780 2011-07-18 23:24 export.php
-rwxrwxrwx 1 amrit amrit 6230 2011-07-18 23:24 fileupload.php
-rwxrwxrwx 1 amrit amrit 11180 2011-07-18 23:25 functions.php
-rwxrwxrwx 1 amrit amrit 2627 2011-07-18 23:25 get_report.php
-rwxrwxrwx 1 amrit amrit 53 2011-07-18 23:24 google8864db9c6fc17639.html
-rwxrwxrwx 1 amrit amrit 18009 2011-07-18 23:25 gpl.txt
-rwxrwxrwx 1 amrit amrit 12673 2011-07-18 23:26 groups.php
-rwxrwxrwx 1 amrit amrit 1732 2011-07-18 23:24 harbhag.css
-rwxrwxrwx 1 amrit amrit 6054 2011-07-18 23:24 harbhag_predictive.js
-rwxrwxrwx 1 amrit amrit 341 2011-07-18 23:25 image_create.php
drwxrwxrwx 2 amrit amrit 4096 2011-08-01 22:12 images
-rwxrwxrwx 1 amrit amrit 10032 2011-07-18 23:25 index.php
-rwxrwxrwx 1 amrit amrit 10032 2011-07-18 23:25 index.php_20110706
-rwxrwxrwx 1 amrit amrit 5395 2011-07-18 23:25 insert.php
-rwxrwxrwx 1 amrit amrit 11685 2011-07-18 23:24 install.php
-rwxrwxrwx 1 amrit amrit 84362 2011-07-18 23:25 jquery-1.5.min.js
-rwxrwxrwx 1 amrit amrit 208229 2011-07-18 23:24 jquery_ui.js
drwxrwxrwx 2 amrit amrit 4096 2011-08-01 22:12 languages
drwxrwxrwx 3 amrit amrit 4096 2011-08-01 22:12 lib
-rwxrwxrwx 1 amrit amrit 16945 2011-07-18 23:28 list.php
-rwxrwxrwx 1 amrit amrit 17754 2011-07-18 23:28 list.php~
-rwxrwxrwx 1 amrit amrit 525 2011-07-18 23:24 lookup.php
-rwxrwxrwx 1 amrit amrit 3953 2011-07-18 23:25 mailsend.php
-rwxrwxrwx 1 amrit amrit 11558 2011-07-18 23:25 mailto.php
drwxrwxrwx 2 amrit amrit 4096 2011-08-01 22:12 mugshots
-rwxrwxrwx 1 amrit amrit 16005 2011-07-18 23:18 options.php
drwxrwxrwx 2 amrit amrit 4096 2011-08-01 22:12 raiBackup
-rwxrwxrwx 1 amrit amrit 7209 2011-07-18 23:24 register.php
-rwxrwxrwx 1 amrit amrit 2852 2011-07-18 23:25 reset_password.php
-rwxrwxrwx 1 amrit amrit 14968 2011-07-18 23:24 save.php
-rwxrwxrwx 1 amrit amrit 4652 2011-07-18 23:24 scratchpad.php
-rwxrwxrwx 1 amrit amrit 6072 2011-07-18 23:25 search.php
-rwxrwxrwx 1 amrit amrit 6351 2011-07-18 23:24 sendsms.php
-rwxrwxrwx 1 amrit amrit 6274 2011-07-18 23:18 sendsms.php~
-rwxrwxrwx 1 amrit amrit 3227 2011-07-18 23:24 show_sent.php
drwxrwxrwx 8 amrit amrit 4096 2011-08-01 22:12 sms
drwxrwxrwx 2 amrit amrit 4096 2011-08-01 22:12 sms_backup
-rwxrwxrwx 1 amrit amrit 422 2011-07-18 23:18 student_search.php
-rwxrwxrwx 1 amrit amrit 4589 2011-07-18 23:24 styles.css
-rwxrwxrwx 1 amrit amrit 10716 2011-07-18 23:25 upgrade.php
-rwxrwxrwx 1 amrit amrit 21680 2011-07-18 23:26 users.php




I changed the permission to 775 and now i can access it.
But here i got another error.I have imported a file in db and i can see tables in mysql database.When i try to access /var/www it is accessible but it gives the error as:

The following error occurred:
An error occurred while trying to connect to the MySQL server. MySQL returned the following error information: Access denied for user 'root'@'localhost' (using password: YES) (error #1045)

If necessary, please press the BACK button on your browser to return to the previous screen and correct any possible mistakes.
If you still need help, or you believe this to be a bug, please consult the Author.



1.04e | |

Thanks

amritpalpathak.blogspot.com
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
lftp mirror: Access failed: 550 /var/www/vhosts/test: No such file or directory speedy6 Linux - Software 11 10-22-2012 02:06 PM
Forbidden with VirtualHost folder other than /var/www/html netweblogic Linux - Server 3 08-28-2008 07:46 AM
URGENT: Apache Server: Directory index forbidden by rule: /aa/www/default/docs/ rrose Linux - Software 1 03-10-2008 08:41 PM
Directory index forbidden by rule: /var/www/html/ danimaldaisy Linux - Networking 6 02-11-2008 01:32 AM
Whenever I create a file in /var/www/html/, it is at permission 600 (forbidden) Josh1billion Linux - Software 4 03-18-2006 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration