LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Forbidden (/var/www/directory access error) (https://www.linuxquestions.org/questions/linux-software-2/forbidden-var-www-directory-access-error-893193/)

amritpalpathak 07-22-2011 01:05 PM

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

{BBI}Nexus{BBI} 07-22-2011 01:09 PM

Check the permissions on that directory
Code:

ls -ls /var/www
will show you permissions and directory ownership.

TB0ne 07-22-2011 01:14 PM

Quote:

Originally Posted by amritpalpathak (Post 4422571)
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.

amritpalpathak 07-23-2011 07:15 AM

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

TB0ne 07-23-2011 07:59 PM

Quote:

Originally Posted by amritpalpathak (Post 4423152)
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.

amritpalpathak 07-24-2011 07:58 AM

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

TB0ne 07-24-2011 02:18 PM

Quote:

Originally Posted by amritpalpathak (Post 4423810)
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?

bathory 07-24-2011 02:54 PM

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

amritpalpathak 07-26-2011 12:19 PM

@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

bathory 07-26-2011 01:01 PM

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.

TB0ne 07-26-2011 03:24 PM

Quote:

Originally Posted by bathory (Post 4425790)
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. :)

amritpalpathak 08-01-2011 12:14 PM

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

bathory 08-01-2011 12:36 PM

So what gives:
Code:

ls -la /var/www/GNDEC-SMS-Service

TB0ne 08-01-2011 09:06 PM

Quote:

Originally Posted by amritpalpathak (Post 4430846)
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.

amritpalpathak 08-02-2011 02:19 AM

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


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