The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Chown Ownerships on User Folders

Discussion in 'General Discussion' started by compunet2, Jan 14, 2005.

  1. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Reciently I had to restore some sites from backups, but now the ownerships on the folders in /home & /home2 are all screwed up. I tried running /scripts/chownpublichtmls, but that didn't work. Does anyone have a simple script that will reset the ownerships for each folder in /home & /home2 to user.user?
     
  2. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    I've generated a file with the following:
    chown user.user user
    chown user1.user1 user1
    etc.

    Line by line it lists every user /folder. How can I script it to run through each line to chown each folder?
     
  3. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Use the following commands in this order.

    cd /home

    for i in `ls -bA /var/cpanel/users`;do chown -R $i:$i $i;done
    for i in `ls -bA /var/cpanel/users`;do chown -R $i:mail $i/mail;done
    for i in `ls -bA /var/cpanel/users`;do chown -R $i:mail $i/etc;done
    for i in `ls -bA /var/cpanel/users`;do chown -R $i:nobody $i/public_html;done
     
Loading...

Share This Page