Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2668  / 3 Years ago, mon, october 18, 2021, 5:35:02

As a webmaster I need fast access to /var/www, what should I set in dir permissions to get rid of 'open as admin' in order to file modification and creation? Yet I want it safe as modificable from my machine only.



Or is there a way to always open everything as admin?


More From » permissions

 Answers
6

here's my suggestion:



$ sudo chown www-data:www-data -R /var/www


(changes the permissions to be owned by www-data). I'm not sure why it defaults to root anyways.



$ sudo gpasswd -a $USER www-data   (add yourself to the www-data group)
$ sudo chmod g+rw -R /var/www #make all files write by group owner.
$ sudo find -type d -exec chmod g+rwx {} ; #find folders and make sure group has rwx access.


logout, log back in.



you should now be able to write any files as yourself.



You could simply chown /var/www to your $USER, though I wouldn't recommend it. partly because it's insecure, and partly because I think some things will probably break if you do.


[#27926] Tuesday, October 19, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ersoggles

Total Points: 69
Total Questions: 111
Total Answers: 111

Location: Vanuatu
Member since Sun, Oct 2, 2022
2 Years ago
;