1

I just installed lamp-server^ and wanted to try it I created a php file but I was not able to move it to /var/www because owner of that folder is root I managed it using terminal (I logged in as root). But I dont want to do it everytime. Is there any other way to do it? I dont want to use terminal every time I want to try to access that folder.

Tim
  • 33,500
Kdaydin
  • 111

1 Answers1

0

I don't know how it is done in LAMP, but a pure Apache setup has a user group called www-data with write permission into /var/www.

To achieve the same result, follow these steps:

  1. Create the group www-data, if not already existent (check with grep www-data /etc/group):

    groupadd www-data

  2. Transfer group ownership of /var/www to www-data, if not already done:

    sudo chgrp www-data /var/www
    
  3. Add your user to the www-data group:

    sudo usermod -a -G www-data <username>
    
  4. Fix permissions, if necessary (give full permission to group members):

    sudo chmod g+rwx /var/www
    

Now you can access the directory without sudoing.

s3lph
  • 14,644
  • 12
  • 60
  • 83