Solved

Access denied on /var/www ubuntu server

Posted on 2013-11-07
8
1,247 Views
Last Modified: 2013-11-20
OK,

I'm new to Ubuntu. I needed to setup a LAMP server to do some PHP testing on. Installation went smooth, no problems. So first issue I have, if I use filezilla or Cyberduck to copy files to the /var/www folder I get access denied. I'm using the user id and password I setup during the installation steps, but still no luck. What am I doing wrong. I am able to go in as root on the command line to edit the index.html file. I changed it to index.php with no problem. I used dreamweaver to setup a FTP site and I'm able to see all the directory structure. I am unable to save a file to that folder from dreamweaver. Newbie needs some help. Please keep it simple.....
0
Comment
Question by:rraymond1130
  • 4
  • 4
8 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
That directory belongs to 'root' and Ubuntu is set up to force you to use 'sudo' to act as 'root'.  You will have to 'sudo' to root to do anything with the files there.  The user id and password should get you access to your own folders in '/home'.  You could FTP to a folder there and then use 'sudo' to copy them from there to '/var/www'.
0
 

Author Comment

by:rraymond1130
Comment Utility
OK,

I was able to copy my php file to my home folder, but I'm unable to open it from there. Now does the PHP files have to be in a certain folder in order to be displayed. This is my first Linux server so I'm a little raw at this.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Yes, PHP files must be in a folder that is part of the web root or web server directories.  PHP must also be installed on the server.  I don't know if it is automatically included unless you did the LAMP install.  See here: https://help.ubuntu.com/community/ApacheMySQLPHP
0
 

Author Comment

by:rraymond1130
Comment Utility
I did the LAMP install myself. There has to be a way to give my user permission to write to this directory to make my php files work?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
this directory
Which directory?

If it is '/var/www', you can change the permissions.  Note that this would Never be done on a publicly accessible web server because it allow anyone to write to that directory.  Open a terminal window and type these commands.
cd /var
sudo chmod 777 www
cd www
sudo chmod 777 *
exit

Open in new window


This will allow you to write to that directory and all the files that you copy there will be under your user.
0
 

Author Comment

by:rraymond1130
Comment Utility
This is a private server not web-facing. Thanks that worked...
0
 

Author Closing Comment

by:rraymond1130
Comment Utility
I thought I closed this question
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Well you have now.  Thanks for the points.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now