Amit Ray Amit Ray - 5 months ago 15
Linux Question

Unable to configure folder permissions in Ubuntu

I found many related questions and tried to solve the issue but I was not successful. Actually I created an user named "amit" and assigned the group "www-data". I gave permission to the folder using this method

sudo chown -R :www-data /var/www
sudo chmod g+w /var/www
sudo adduser amit www-data


Change folder and file permission recursively:
To change all the directories to 755 (-rwxr-xr-x):

find /var/www -type d -exec chmod 755 {} \;


To change all the files to 644 (-rw-r--r--):

find /var/www -type f -exec chmod 644 {} \;


But in joomla system info when i check i get all directories as non writable.
So I changes this command to

sudo chown -R www-data:www-data /var/www


Surprisingly this worked.
I need to know why the created user didn't work but this one worked, where did I miss something?

Answer

Applying chmod 755 (rwxr-xr-x) for directories and chmod 644 (rw-r--r--) for files just makes the writable for the owner, but not for the group. If you want to grant the group write permissions then you need 775 and 664.