3

I have downloaded Apache on Ubuntu by following this tutorial. It installed the Apache nicely and it is running successfully but there is one problem which is a huge one. I do not have permissions to Write to /var/www folder although I am Administrator. The current owner of that www folder is root. I have installed Ubuntu today so I don't know much about it. I have used chown command but it throws error : Operation not permitted.

Can anybody tell me so that I can have Read & Write permissions?

  • "I have used chown command but it throws error : Operation not permitted." your forgot to put sudo in front of your command. And the user and group of things inside /var/www/ should not be root but apache or www-data ;) (see the apache.conf or sites-enabled for the correct one). – Rinzwind Sep 05 '13 at 13:07
  • @Rinzwind Hey, man I am reading docs. Read about sudo, gives us Super User priviliges. Let me run the command ;) – Muhammad Talha Akbar Sep 05 '13 at 13:11

3 Answers3

2

It is not advisable to change the ownership of the /var/www folder, leave it as root. If you need to create new files or folders inside /var/www leave them also under root ownership; or owned by you user if you prefer. For Apache to serve these assets all you need to do is provide read permissions to the www-data user:

sudo chmod a+r /var/www/my.asset

Also, consider using instead the /srv folder to store assets that must be served by applications such as Apache.

Luís de Sousa
  • 13,227
  • 26
  • 81
  • 128
1

open your terminal and type as

chmod 744 -R /var/www/

I have faced the issue too and resolved by the above command. hope that helps.

Only root user have complete permissions. Normal user and others are only able to read and can not able to write or execute.

Next with

chmod 754 -R /var/www/

root can do everything. Normal user can read and execute but can not write. other user can read but can not write and execute.

Raja G
  • 102,391
  • 106
  • 255
  • 328
0

You can access the files in /var/www/ easily by using nautilus as root:

sudo nautilus

I would not recommend changing ownership or permissions of the directory because of potential security risks.

Joren
  • 5,053
  • 8
  • 38
  • 54