File and Folder Ownership

Is there a script or action in webmin/virtualmin that automatically restores and sets ownerships for users files and folders ?

I am having issues when upgrading certain sites , the fiels and folders is set to "www" as ownership which means I cannot delete these files. Is there a way to on daily basis check and set all folders and files to ownership of that user?



Howdy -- the only time that a file/dir should be owned by the 'www' user is if the Virtual Server has a PHP Execution Mode set to "mod_php".

That's configurable in Server Configuration -> Website Options.

When possible, we'd suggest using CGI or FCGID, which uses suexec. With suexec, the PHP code is executed as the Virtual Server owner, and not as the Apache user.

As for how to fix file and directory permissions -- there is a way to do that from within Virtualmin.

You can do that in Limits and Validation -> Validate Virtual Servers -> Fix Permissions.

I don't believe there's a way to do that from the command line though -- that's something you'd need to manually do from within Virtualmin.

i dont know if it has anything to do with it but i am running nginx upon apache to improve speed is that somethings that would effect changing to CGI or FCGID? Also I assume if switching to suexec it will cause the websites not to work as there is only two CMODs working with this (755 or 644 if not mistaken) ?

The Virtualmin thing "Limits and Validation -> Validate Virtual Servers -> Fix Permissions." was a great option btw.

Most web apps work with no problem using suexec. It's difficult to say for certain if there would be a problem with your particular app, that's something you'd need to test... but suexec is enabled by default in Virtualmin.

But if you just wanted to run the Fix Permissions thing on occasion using mod_php, that works too :-)