I want to move my web content from Window 7 to Ubuntu 12.04. So I copy my web content and move it to my /opt/lampp/htdocs folder, then I have change the folder permission using:

sudo -s 
cd /opt/lampp/htdocs
sudo chmod 777 -R myWebContent

Then folder permission is changed. But still I can not access my php file, because it only change the folder's access permission, not a single php file's permission. How can I solve this?

  • I think you should descend up to /opt/lampp only and then do chmod 777 -R htdocs. I think that the htdocs folder is still restricted.
    – ankush981
    Mar 20, 2014 at 17:20
  • This link will help you. See the second method of doing this for a security concern.
    – Gowtham
    Apr 19, 2014 at 15:32

2 Answers 2


instead of chmod 777 you should better to change the owner to www:www and keep 644 or 755 security. Under www user the apache is running and will have read-write-execute access, but other users will have just read or read-execute only access. Try this:

sudo chmod -R 755 /opt/lampp/htdocs
sudo chown -R www-data:www-data  /opt/lampp/htdocs
  • Hey, if I do this I find that I'm not able to use my text editor to write files to htdocs. What to do?!
    – ankush981
    Mar 20, 2014 at 16:54
  • you can add yourself to the www:data group and use 775 / 664, or you can write it as a root. If you write new files, you will have to change ownership again. Obvious but secure.
    – Dee
    Mar 24, 2014 at 10:16
  • Hmmm, but does it matter if I'm experimenting on the local machine? If I then FTP the files to the web server, it's going to have its own permissions set up and there will be no problem. What say?
    – ankush981
    Mar 26, 2014 at 15:52
  • you can change (and you should) permissions on FTPd web server as well.
    – Dee
    Mar 28, 2014 at 1:21

I know this question is super old but for anyone reading out there... you probably don't need to do that if all you want is to be able to freely change and add files that use the lamp stack.

You could always change the httpd-vhosts.conf file, add the port and the path to a more suitable directory and that's it.

<VirtualHost *:80> 
 DocumentRoot "/path/to/dir"        
 ServerName DevEnv
 Other directives here

I personally rather :

Opt/Lampp/htdocs Sudo .nautilus 

Then you can do whatever you want in there and open the htdocs with your code editor and all that.

no messing with permissions and stuff.

  • 1
    Can you please expand on this answer with more information? Things like where the file is found, and what to edit in the file. It may also be helpful to provide a step by step guide for anyone who has similar issues. :) Mar 2, 2017 at 20:33

Not the answer you're looking for? Browse other questions tagged .