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!

fixing file ownerships

Discussion in 'General Discussion' started by verdon, Feb 12, 2007.

  1. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    870
    Likes Received:
    3
    Trophy Points:
    168
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
    If I had a bunch of files in various /home/user/public_html dirs that were owned by root and not the user, would something like the following work to fix them up? Please keep in mind while you are guffawing that I know next to nothing about perl...

    Code:
    #!/usr/bin/perl
    print "Starting Scan...\n";
    while(@USERS=getpwent()){
        if (-d "$USERS[7]/public_html") {
            system("find", "$USERS[7]/public_html", "-user root", "-exec chown $USERS[2]:$USERS[3]") or die "cannot find in this dir.\n";
        }
    }
    print "Scan Complete!\n";
    
     
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