How to resolve /var/www copy/write permission denied?

Viewed 128050

I am a newbie in php, mysql. I have written a hello.php script, which I am trying to copy into /var/www directory (and will later want to open it through web browser). The problem with the same is that I am not allowed to save/write any files in /var/www despite me being the root. I tried implementing steps in this question, but I get the following error when I process the third line

find /var/www/ -type f -exec chmod g+w '{}' ';'
chmod: changing permissions of `/var/www/index.html': Operation not permitted

I know symlink is also an option. I would want to be able to write/copy files directly to /var/www/ directory.

Any suggestions on what is going wrong?

13 Answers
sudo chown -R $USER:$USER /var/www

Enter the following command in the directory you want to modify the right:

for example the directory: /var/www/html

sudo setfacl -m g:username:rwx . #-> for file

sudo setfacl -d -m g:username: rwx . #-> for directory

This will solve the problem.

Replace username with your username.

The problem is a privilege issue navigate to the var/www/ right-click in it and select open as admin then continue your work

Related