NYCPHP Meetup

NYPHP.org

[nycphp-talk] TAR and permissions

Hans Zaunere hans at nyphp.org
Sun Oct 26 10:15:49 EST 2003



Marc Antony Vose wrote:

> Hi there:
> 
> I've written a simple script that's moving files from a staging server 
> location to the live server area (virtual servers on the same Linux box).
> 
> I'm doing it by creating a TAR file from specified files in the staging
> area, copying the TAR file over to the live area, and extracting it.
> 
> My problem is that all files coming out of the archive are having the 
> user and group 'apache' assigned to them.  Is it possible to accomplish 
> this without altering the user/group information?

The file ownership becomes that of the user making the write to the disk.  --preserve or --same-owner may help, but as time points out it's problematic at best.  You could also consider using cp -pr   which works pretty well, or good old chown :)

> (The script is being run from a Web interface...PHP scripts are being 
> parsed by the PHP Apache module, not the CGI version.)

As a heads up, doing filesystem operations, especially when involving multiple users, can get sticky.  It's always worked best to execute some out of apache process to do the filesystem operations; PHP CLI works great! :)

H





More information about the talk mailing list