Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.