Grand Permision to group www-data

Standard
  1. Add your user to www-data group:

CREDIT Granting write permissions to www-data group

You want to call usermod on your user. So that would be:

sudo usermod -aG www-data yourUserName

** Assuming www-data group exists

  1. Check your user is in www-data group:groups yourUserName

You should get something like:

youUserName : youUserGroupName www-data

** youUserGroupName is usually similar to you user name

  1. Recursively change group ownership of the folder keeping your user ownershipchown yourUserName:www-data -R youWebSiteFolder/*
  2. Change directory to youWebSiteFoldercd youWebSiteFolder
  3. Recursively change group premissions of the folders and sub-folders to enable write permissions:find . -type d -exec chmod -R 775 {} \;

** mode of `/home/yourUserName/youWebSiteFolder/’ changed from 0755 (rwxr-xr-x) to 0775 (rwxrwxr-x)

  1. Recursively change group premissions of the files and sub-files to enable write permissions:find . -type f -exec chmod -R 664 {} \;

The result should look something like:

WAS:
-rw-r--r--  1 yourUserName www-data  7192 Oct  4 00:03 filename.html
CHANGED TO:
-rw-rw-r--  1 yourUserName www-data  7192 Oct  4 00:03 filename.html

Equivalent to: chmod -R ug+rw foldername Permissions will be like 664 or 775.

Leave a Reply