I have a LAMP server where I’ve run the following commands to set permissions of files in /var/www:
groupadd web
usermod -a -G web my_user
chown -R root:web /var/www
chmod -R 775 /var/www
chmod -R g+s /var/www
My goal is to have all files writable by any member of the “web” group. Is there a secure way to allow file uploads (e.g. within WordPress) without changing the file ownership? Note: this is a private server.
One way of applying permissions to just directories is to use the
findcommand. For example:You don’t want to run
chmod -R 775 /var/wwwbecause this will make all your files executable, which is probably not what you want.