How do I change file permissions in Ubuntu [duplicate]

Posted on Nov 3, 2022

Question

In Ubuntu I want to change the file permissions of a whole folder and all its sub folders to read/write by anybody

I have tried sudo chmod 666 /var/www and sudo chmod 755 /var/www without success

update

I have since found that changing privileges can also be done in the GUI by opening nautilus as sudo.

Answer

So that you don't mess up other permissions already on the file, use the flag +, such as via

sudo chmod -R o+rw /var/www