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.
Asked
Active
Viewed 2,880 times
1
1 Answers
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:
Create the group
www-data, if not already existent (check withgrep www-data /etc/group):groupadd www-data
Transfer group ownership of
/var/wwwtowww-data, if not already done:sudo chgrp www-data /var/wwwAdd your user to the
www-datagroup:sudo usermod -a -G www-data <username>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,314
- 11
- 59
- 82
sudo cp foo barto copyfootobar. – terdon Jun 07 '15 at 17:07/var/www) you should use sudo cp to copy. The permissions of them shouldn't be changed (/var/www is an exception). – Tim Jun 07 '15 at 17:08