Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007
    Location
    Florida
    Posts
    1,930

    Question chown a files to match a directory?

    I'm about to copy some site specific files (custom error pages) to all of my user's public_html directories. I still want my users to be able to use their own custom error pages so I need to chown all of the files to match my user's accounts (I'm using suPHP) so they can delete/overwrite them if they want to later. Is there a way to get the username from another file or directory and chown the ###.shtml files to match that?
    -Joe @ Secure Dragon LLC.
    + OpenVZ Powered by Wyvern | KVM | cPanel Hosting | Backup VPSs | LowEndBoxes | DDOS Protection
    + Florida | Colorado | Illinois | California | Oregon | Georgia | New Jersey | Arizona | Texas

  2. #2
    You'd need to write a simple shell script to go through each home directory and chown the files in question to match the owner of the directory. Have a google and you should be able to find what you need.
    Accelerated Hosting - From Constant Internet
    Automatically serving your website from the nearest server
    Get hosted on our global network! America / Europe / Asia

  3. #3
    Would it not be easier to just place/edit the .htaccess file to point to a global set of 404/error pages etc.

    Then if users want their own they just edit the .htaccess file with the new location of their files..
    Ore Stone Radio
    Playing the best unsigned new music 24 hours a day
    Musicians - Visit our forums to submit your music for airplay

    www.orestoneradio.com an Ore Stone Music Ltd. Company

  4. #4
    Join Date
    Feb 2007
    Location
    Florida
    Posts
    1,930
    I moved the .shtml files over and /scripts/chownpublichtmls did the trick!
    -Joe @ Secure Dragon LLC.
    + OpenVZ Powered by Wyvern | KVM | cPanel Hosting | Backup VPSs | LowEndBoxes | DDOS Protection
    + Florida | Colorado | Illinois | California | Oregon | Georgia | New Jersey | Arizona | Texas

  5. #5
    Join Date
    Mar 2009
    Location
    /home/khunj
    Posts
    432
    Just in case it may help, you can CHOWN a whole directory tree using the recursive option (-R or --recursive) :

    # chown -R user:group /path/to/userdir/

    /path/to/userdir/ and all included files/directories will be chowned to user:group
    NinTechNet
    ★ NinjaFirewall : Web Application Firewall for PHP and WordPress.
    ★ NinjaMonitoring : Monitor your website for suspicious activities.

  6. #6
    Join Date
    Feb 2007
    Location
    Florida
    Posts
    1,930
    Yeah, but doing that command over 1500 times takes a while.
    -Joe @ Secure Dragon LLC.
    + OpenVZ Powered by Wyvern | KVM | cPanel Hosting | Backup VPSs | LowEndBoxes | DDOS Protection
    + Florida | Colorado | Illinois | California | Oregon | Georgia | New Jersey | Arizona | Texas

Similar Threads

  1. How do I Move Files & Subdir (without changing Chown & Chmod)
    By hbhb in forum Hosting Security and Technology
    Replies: 8
    Last Post: 04-02-2008, 06:18 AM
  2. cPanel issue with proper chown/mod on uploaded files
    By Sykoi in forum Hosting Software and Control Panels
    Replies: 3
    Last Post: 08-24-2007, 12:04 PM
  3. CHOWN a whole directory + subfolders + files
    By zmontano69 in forum Hosting Security and Technology
    Replies: 6
    Last Post: 02-14-2004, 01:00 AM
  4. How can CHOWN a directory and all child directories + files?
    By zmontano69 in forum Hosting Security and Technology
    Replies: 8
    Last Post: 01-26-2004, 06:48 PM
  5. How to chown files owned by Apache?
    By biosphere in forum Programming Discussion
    Replies: 3
    Last Post: 05-01-2003, 04:58 PM

Tags for this Thread

Posting Permissions

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