Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Can someone write me a quick chowing script?

Discussion in 'General Discussion' started by noimad1, Oct 17, 2006.

  1. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    166
    I've been working all night with no sleep restoring a server that was hacked. however, all of my file owners are all messed up.

    Could someone write me a quick script (if possible) that would search through the /home directory and chown -R all of the files for each users root home directory to that users account?
     
  2. jugo

    jugo Active Member

    Joined:
    Nov 23, 2005
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    156
    Try this

    Try this bro...

    Code:
    #!/bin/sh
    
    ls -A /var/cpanel/users/ > users
    for account in `cat users`
    do
    echo "***************************"
    echo "** chowning $account     **"
    echo "***************************"
    echo ""
    
    chown -R $account:nobody /home/$account
    
    echo "***************************"
    echo "*** $account Completed ***"
    echo "***************************"
    echo ""
    done
    
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    That won't quite work. Only the /home/username/public_html directory is username:nobody ownership. Everything in that directory is supposed to be username:username.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    166
    Thank you. I was able to use your script and modify it a bit and run it again for the public_html directories....

    Thank you!
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice