Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arguments for chown?

    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 [pre]chown --from=apache dylan1 ./[/pre] but it did not work. I don't have a clue.
    Last edited by Dylan Leblanc; 07-03-2003 at 12:44 PM.

  • #2
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Isn't "pre" a UBB code?

    Why can't you just "save picture as"?

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Many hosts disable/limit chown but the basic syntax is ...

    chown dylan1 filename

    you can also use wildcards * to do the whole directory.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #5
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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
    Description
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •