Solved

Access denied on /var/www ubuntu server

Posted on 2013-11-07
8
1,262 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 83

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 83

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
 

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 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 83

Expert Comment

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

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Anti-Spam SMTP Proxy Server (@SSP) 7 82
Can't See Site After DNS Resolved 7 47
Backup & Restore 3 46
Penetration Testing home based work 3 47
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now