SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Directory Ownership problem

    Hi, I think this is the right place, because I am fairly certain of the problem, just unsure how to fix it.

    I have created a file upload script, that checks to see if a dir exists, if not creates it, then uploads a file to it. The dir is chmod 755.

    However, I am now unable to delete these directories e.g. through my FTP program. It looks as though it is deleting them, but doesn't actually do it.

    I assume this is because ownership of the dirs has been placed elsewhere (I think I read at php.net about how ownership is given to apache who is essentially noone).

    I don't have shell access, either. Is there anyway to delete these folders? I have tried chmod 777 on them, which doesn't appear to help.

    Cheers

    Matt
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If a script created the directories then they are owned by apache so you can delete them via script..

    <? unlink('/home/user/domain/dirname');?>

    & as a last resort... exec('rm -f /home/user/www/dirname');
    just get the dirname exactly right
    if the directory is not empty you can use -R (recursive) but thats real dangerous
    Last edited by firepages; Feb 28, 2003 at 21:09.

  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you want to be able to get to the m through normal FTP as well, use PHP's ftp functions.

    Aaron
    Aaron Brazell
    Technosailor



  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by firepages
    If a script created the directories then they are owned by apache so you can delete them via script..

    <? unlink('/home/user/domain/dirname');?>

    & as a last resort... exec('rm -f /home/user/www/dirname');
    just get the dirname exactly right
    if the directory is not empty you can use -R (recursive) but thats real dangerous
    Thanks, I'll give it a shot...

    Er Sketch, what do you mean?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  5. #5
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unlink is only used for deleting files... had to use rmdir... but it appears to have done! Cheers for the advice!
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the record:
    PHP Code:
    $cnx=ftp_connect('ftp.mydomain.com');
    ftp_login($cnx,'user','pass');
    //to make a dir owned by 'user'
    ftp_mkdir($cnx,'dirname');
    //To remove a dir owned by 'user'
    ftp_rmdir($cnx,'dirname');
    ftp_close($cnx); 
    Aaron Brazell
    Technosailor



  7. #7
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    having FTP login in a file = teh dangerous!

    i think i will have that ftp_ functionality in my forum for writing the config file if, for some unknown reason, someone doesn't want it to be world-writable. however, you'd have to enter it each time. no way would i store it in a file.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR


Bookmarks

Posting Permissions

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