Recursively change group & ownership to www-data and give write access

Change owner

sudo chown -R OwnerName /path
sudo chmod -R g+rw /var/www/html/

Change Group permission

sudo chgrp -R groupname /path/of/directory

Change owner and group 

#sudo chown -R owner:group /var/www/html/
sudo chown -R www-data:www-data /var/www/html/


To add existing user kim to group www-data

sudo usermod -aG www-data kim
id kim
groups kim

Forget -a flag and you will belong to www-data group only


Add a new user to www-data group

sudo useradd -g www-data kim

Add existing user to www-data group

sudo adduser kim www-data

Leave a Comment

Your email address will not be published. Required fields are marked *