**Change the directory owner and group:**
sudo chown USER:www-data /var/www
**Allow the group to write to the directory with appropriate permissions:**
sudo chmod -R 775 /var/www
**Add yourself to the www-data group:**
sudo usermod -a -G www-data USER