View Full Version : Arguments for chown?
07-03-2003, 12:41 PM
I have a bunch of images which were created by PHP, so their owner is apache. I want to download them through FTP, but don't have permission (since I am user dylan1).
How can I chown all the files in a certin dicectory so they are owned by dylan1 rather than apache?
I tried chown --from=apache dylan1 ./ but it did not work. I don't have a clue.
07-05-2003, 03:05 AM
Isn't "pre" a UBB code?
Why can't you just "save picture as"?
07-05-2003, 05:45 AM
Many hosts disable/limit chown but the basic syntax is ...
chown dylan1 filename
you can also use wildcards * to do the whole directory.
And you will most likely need to be a superuser account or god account to change ownership. If you are hosted, typically you can request your host to change the ownership. You can also write a script that sets itself to NOBODY and can then access the files and let you download them. In the future, you may want to set your script's ownership (or put it in a proper owner wrapper) so that when it creates files, it has the same ownership as files you create on the server under your account.
07-11-2003, 01:51 PM
Well, I'm not sure where you're generating the file from, but as you mention you say apache is creating it. This would lead me to beleive that it's from a form upload and you're saving it on the server correct? If so, take a look at this in the php manual:
(PHP 3, PHP 4 )
chown -- Changes file owner
int chown ( string filename, mixed user)
Attempts to change the owner of the file filename to user user (specified by name or number). Only the superuser may change the owner of a file.
Returns TRUE on success or FALSE on failure.
Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.
See also chmod().
My guess is if when you save the file in php and the owner is set to apache, if you try to chown in php, you will still have the apache permissions so it should go. Although is says only the superuser (root) can change the owner, usually the owner of a file can change the owner as well. Never tried it though, but hey it's worth a shot.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.