Kevin's picture

Is there any way I can automatically Chmod the directory where I serve my websites.

This would make it easier to work with files.

This might seem a daft question, but I am still on a Linux learming curve.

Don Sanderson's picture

chmod -R XXX /var/www will change the permissions on the /www directory and all files/directories within it to XXX.


The SGID bit can be set on the /www directory to automagically set the group ID (GID) on all files created in, or copied to, that directory. And inherit that groups permissions.

See here:

Note: SGID does not work when files are MV'd so always use CP when transferring files to SGID'd folder.

Jeremy Davis's picture

May be to just add the Linux users who you want to be able to edit /var/www to the www-data (webserver) user group.

Add new comment