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,811 times
1
-
Im not just interested in that specific folder. Any folders with root owner. I want to know what to do If it happens again with another folder. – Kdaydin Jun 07 '15 at 17:06
-
same applies, just use different group. what other folder are you thinking of? – Tim Jun 07 '15 at 17:07
-
@L0RDQB you just use `sudo cp foo bar` to copy `foo` to `bar`. – terdon Jun 07 '15 at 17:07
-
@L0RDQB any root folders (other than `/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
-
is there any other way like giving root access to my current user ? – Kdaydin Jun 07 '15 at 17:09
-
I created a symlink to a folder on my desktop for easy access! – Alvar Jun 07 '15 at 17:09
-
@L0RDQB yes I have a symlink too to a folder called Website for me :) – Tim Jun 07 '15 at 17:16
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,118
- 11
- 57
- 82