Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access denied on /var/www ubuntu server

Posted on 2013-11-07
8
Medium Priority
?
1,463 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 84

Expert Comment

by:Dave Baldwin
ID: 39631874
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
ID: 39632059
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 84

Expert Comment

by:Dave Baldwin
ID: 39632078
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:rraymond1130
ID: 39632089
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
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39632202
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
ID: 39632233
This is a private server not web-facing. Thanks that worked...
0
 

Author Closing Comment

by:rraymond1130
ID: 39663915
I thought I closed this question
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39663933
Well you have now.  Thanks for the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

886 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