Web lists-archives.com

Re: [PHP] ftp scripts?

Changing ownership is a root only operation.  You'll need to script a terminal (ssh) session to issue those commands.

On September 25, 2015 6:20:14 PM EDT, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:
>Hi folks;
>This is something I have not attempted as yet. it is a bit
>off topic, as it is a question more about ftp use than php.
>I have a package of php and html/php files spread over a
>directory structure (unix based server platform)
>What I want to do is create a script that will transfer ownership,
>wholesale from ftp user to the web server user. Because , once placed  
>on a site via ftp,
>the package files and directories will NOT be owned by the web server  
>I can have php enter a directory, make copies of all the files it
>finds, under a different name, but if the directory is not set to
>world readable/writable, php will not be able to remove the originals.
>The same is true for directories.
>So at some point I at least need to make all the directories and file
>perms  707 or 777 for dirs and 606 or 666 for files. That cannot
>be done by server/php because the server does not yet own the
>files and directories.
>SO: To automate this process, I would need  a script to issue ftp
>commands under the auspices of the ftp user account. Or, just
>do chown with a CLI script and set appropriate perms for the files
>and directories.
>I am guessing that that would have to be done with a php CLI or
>shell script owned by the ftp user account.
>But how do I invoke a shell script or php CLI script via ftp?
>I am aware of the possibility of making the ftp user part of the
>group associated with the server user account, of setting the
>'s' bit. But, considering a remote host which may have different
>configurations, and not having admin access to the site, naturally,
>this seems the most universal approach ( shell of cli script to invoke
>remotely via ftp).
>I am working on a custom content management system that
>has upload, download, zip making, unzip to site directories
>and php script pages that are written to and used as php
>script based flat file database scheme. All the directories
>and select files must be manageable and writable by php. To add some
>security, the site administration can only be done via html/javascript
>interface. This in turn will be restricted to users with adequate login
>credentials. Php can manage permissions for its own files  
>Thanks for time and attention
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Sent from my Android device with K-9 Mail. Please excuse my brevity.