Google Plus

avoid using sudo when working in /var/www

Written by Mel Kham on . Posted in Frequently Asked Questions

Question

 

How to avoid using sudo when working in /var/www?

 

 

 

Answer  :

Add  the  user  to the www-data group and set the setgid bit on the /var/www directory so that all newly created files inherit this group as well.

sudo usermod -a -G www-data "$USER"

Correct previously created files (assuming you to be the only user of /var/www):

sudo chown -R "$USER":www-data /var/www
find /var/www -type f -exec chmod 0660 {} ;
sudo find /var/www -type d -exec chmod 2770 {} ;



OR

sudo chgrp www-data -R /home/[YourHome]

Then by replacing /var/www by your own folder :

sudo mv /var/www /var/www.old;
sudo ln -s /home/[YourHome]/public_html /var/www;


For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

AD

|

I need some Help on Linux,can you guide me ?

Edson Carlos

|

In debian no found. I need link download install in linux debian

jacky can

|

You can actually unzip your secret archive by leaving out the -t option, instead using:

unzip newPhoto.jpg

DragonFartOutLoud

|

it went to china.

DragonFartOutLoud

|

great review! i’ve been using it as my main OS since Beta 1 release. its been a awesome ride so far :)

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .