add www-data permission in html

- Posted in Linux by

add user "demo" to group "www-data" (below replace demo with your username)

sudo usermod -a -G www-data demo

set permissions for user group www-data

sudo chgrp -R www-data /var/www/html

followed by

sudo chmod -R g+w /var/www/html

Now you can modify files as "demo" via SFTP and your wordpress installation can modify files without requesting credentials

(1) Allow Apache access to the folders and the files.

sudo chgrp -R www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+rx {} +
sudo find /var/www/html -type f -exec chmod g+r {} +

source: _