[nycphp-talk] Issues with File Permissions

Randal Rust randalrust at
Wed Jul 6 09:33:09 EDT 2011

We have a site where if we create a folder or file on the server the
Owner/Group is one name (foo/foo) and if we use the CMS the
Owner/Group is another (bar/bar).

Typically, we set folder permissions to 0777 so that we don't have to
open and close directories for uploading files. However, a hacker
uploaded a couple of files to one of these directories last week, so I
am trying to add code that uses chmod() to properly open and close

The issue I'm running into is that this only works through the CMS if
the Owner/Group of the directory or file is bar/bar.

I'm trying to figure out what my options are here. Here are a couple
of possibilities:

1. Use bar/bar to create a duplicate directory, copy all of the files
from the original directory to the new one, delete the old directory,
rename the new one. Essentially this makes everything owned by

2. See if tech support can change the Owner/Group on the server for
the entire directory.

I am not very savvy with this sort of thing, so shell access is really
beyond my skill set. Is it possible to change these settings via SFTP?
Or is there a way via PHP to change the Owner/Group that I am
accessing the files as?

Randal Rust
R.Squared Communications

More information about the talk mailing list