Permissions for apache webroot folder on dev server?
Solution 1
I am working on a related issue, but in your case, you could just add yourself to the web group
sudo adduser $USER www-data
replace USER$
with your username of course.
www-data
is the group used for apache web access.
Solution 2
don't use 777 just because it "works". You can use easier notation such as u+rwx
in order to give the user the right permission. g
for group, u
for "user" and o
for "others". chmod ugo+rwx
is then equal to 777; anyone can do anything with any files or directory. Usually not what you want.
You may want to use setgid on the directory using chmod g+s
. This way, when someone changes a file, the group ownership will stay the same. Also, when you create new files and directories, this will be inherited.
Solution 3
If you use an desktop environment, you can do this.
Open the terminal and enter:
gksudo nautilus
Enter your password and hit Enter. Navigate to the www folder and right-click. Choose properties and afterwards permission. Now you can change the access.
To quit Nautilus, just close it and to close the terminal, idem.
Related videos on Youtube
Hailwood
I could tell you all about me... but I'd prefer to let my work do the talking for me!
Updated on September 18, 2022Comments
-
Hailwood over 1 year
I am a web developer and have Apache setup on my local system for testing.
I keep running into issues with the permissions e.g. unless I chmod any new directories to 777 my IDE cannot write to the files there.
I was hoping there was a way to add myself to the group that has control of the
www
folder (and any sub folders) so I do not have to chmod the files every time. -
The33Coder about 11 yearsThanks for the info, but if I'm the only one with ssh access to the box, can it still be a problem?
-
The33Coder about 11 yearsnot sure what I'm doing wrong, but this didn't work for me :(
ubuntu@domU-12-31-39-16-26-01:/var/www$ sudo useradd ubuntu www-data Usage: useradd [options] LOGIN
-
Jo-Erlend Schinstad about 11 yearsYes, never neglect security. Give yourself the correct permissions, but not any other user. Remember; humans aren't the only users on your system. If one service gets compromised, it should not have the ability to compromise another.
-
gabriel_agm about 11 years@Alan: useradd and adduser are different commands and commonly confused. You can add your user to the group www-data with: sudo adduser $USER www-data As $USER is part of the env. vars - no need for replacement.
-
Pavak Paul about 10 yearswhere we have nautilus in a VPS server?