1

This is a bit technical:

I do localhost development on Mac High Sierra and other Mac systems on my local network.

I have been working on content management code in php. Recently I have come up with the idea of adding my FTP user account to the _www group.

Then files placed in the document root folder can be turned over to the web server user account by copying the FTP user owned content using a php script. So this does not change the group. That is also done by php script I am developing.

The point is to be able to edit content both with php and with FTP user and set "everyone" to no access. Directories are given 0770 perms and files 0660 perms.

BUT I have a directory on the desktop with FTP user ownership and "staff" group ownership. When I upload this content to the document root using FTP client the content group is changed to _www (but not the content ownership). The php script is not a CLI script that would be run by the FTP client (Fetch).

I have tried using the finder to place this content in document root. Doing that the group is NOT changed.

But, since the content has been moved to the document root folder, I want to copy it back to the desktop. The copy now on the desktop has _www as group.

THE QUESTION:

Is there some behind the scenes security issue with this approach? Luckily I can use SUDO (or root) to change ownership and group assignments.

More info:

But on a remote site that will not be possible and I am having trouble with the scripts not executing chgrp (change group) and NO errors are reported. The code just doesn't do it.

I have been doing development long enough to know to test to see that the code is actually being attempted by the script as it runs.

Thank you for time and attention

JK

(EDIT) further info; I am making headway on php script dev. The _www group issue is not turning out to be as much of a problem as I thought. I have to write a recursive function to to the copying and deleting the original and then renaming the copy to the original. I have written a recursive method that does do this but it is embedded in another class def and is private and only usable in the context for which it was developed.

2
  • 1
    On macOS, the default is for newly created files to inherit their group assignment from the directory they're created in. This can be overridden (to some extent) by the program doing the creating, but that's the default. Moving a file does not change either the owner or group. – Gordon Davisson Dec 5 '19 at 7:43
  • OK; so the FTP client copies content to the document root. So the content copied to document root inherits the group of localhost document root (set to _www). And copying the content in document root with the finder sets the copy content group to _www as well (?) – JeffK Dec 6 '19 at 21:32

You must log in to answer this question.

Browse other questions tagged .