0

I would like to be able to edit the source code of my website from my editor and also allow the website to load in the browser. With sudo chown -R 'www-data':'www-data'the code is not editable but loads on the browser and with sudo chown -R 'username':'username' the other way around. How can I get both?

Shakur
  • 101
  • 1
  • 3
  • There are so many possibilities and this question has been asked many many times over. Personally I keep those files owned by root and as much as possible ro by www-data, but there are many options and it varies with your use. It this a production or test server ? enable home directories is another option. – Panther Feb 28 '14 at 15:48

1 Answers1

0

First, give the ownership to www-root using the command:

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

Then, give permissions to group members using the command:

sudo chmod -R g+rw /var/www

Finally add your username to the www-data group using this command:

sudo adduser your_username www-data

This way, you will be able load on the browser as well as edit the files.

myusuf
  • 130