I cannot save a php file in var/www/html and my computer shows error "Permission denied".

How to change permission to save file here?


You need to change the permissions for /var/www/html folder.

running this command will give everyone write access to the html fodder.

sudo chmod  o+w /var/www/html

The o stands for other and the + adds the permissions w is write.

Then you should be able to copy you're php file over to /var/www/html with out using Root permissions

If you want to learn more about the command chmod click on the link below.


| improve this answer | |

You need to change the permissions of that folder to gain access to write files. Here is the GUI method. Only use terminal to open Nautilus with root permisions. There is a risk opening Nautilus as root. Read it here.

  1. Open Terminal
  2. type sudo nautilus hit enter
  3. Navigate to the target file or folder you want to change permissions (/var/www)
  4. Right click the file or folder (html folder)
  5. Select Properties
  6. Click on the Permissions tab
  7. Click on the Access files in the Others section
  8. Select “Create and delete files”
  9. Click Change Permissions for Enclosed Files
  10. In the resulting window, Select Read and Write under Files and Create and delete files under Folders
  11. Click Change
  12. Click Close.
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.