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.

chowning a million accounts [Maybe 200 or so]

Discussion in 'General Discussion' started by reddrake, Dec 14, 2003.

  1. reddrake

    reddrake Well-Known Member

    Joined:
    Apr 2, 2003
    Messages:
    79
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Wisconsin,Usa
    Hello, I was wondering if theres anyway to chown all the accounts to there user. I had to do a manual hd transfer.
    All the accounts are set on root and its going to be hard to do one by one. Is there any script or anyway to chown them to the user?

    Regards,
    Brian
     
  2. 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
    Try this.

    for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:$CPAccess /home/$CPAccess/public_html; done

    for CPAccess in `ls -A /var/cpanel/users`; do chgrp nobody /home/$CPAccess/public_html; done
     
  3. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    When I do either of those commands, it doesnt work.
    here are the outputs for those two commands.

    chown: `:': cannot omit both user and group

    chgrp: getting attributes of `/home//public_html': No such file or directory
     
  4. catwalkx

    catwalkx Registered

    Joined:
    Dec 11, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Instead of /home/, try /home2/

    Cpanel seems to create user accounts on home2
     
  5. 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
    That means it is not find anything for

    ls -A /var/cpanel/users

    please verify that the above command returns a result.
     
  6. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    Yes sir, when I do that command I get the user list.
     
  7. 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
    Were you root? (I know just asking)

    I just retried them and they worked. What O/S? RH?

    Did you use cut & paste?


    This is strange.....
     
  8. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    Yes, I was root. No offense taken, I understand that a lot of people are not when trying to run scripts.

    I did cut and paste. I have RHL 7.3 I think with the latest stable cpanel release, if that helps any.
     
  9. 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
    Since the ls -A command worked when you typed it try this..

    for CPAccess in `ls -A /var/cpanel/users`; do echo $CPAccess; done

    This does the same thing it echos the results of the ls -A command back to you.
     
  10. rix

    rix Well-Known Member

    Joined:
    May 1, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    for this line
    for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:$CPAccess /home/$CPAccess/public_html; done

    try to use $CPAcess.$CPAccess

    the real command should be
    for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess.$CPAccess /home/$CPAccess/public_html; done

    because most of the time i use user.group to chown it might help.
     
  11. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    Ok, this is what I did:

    `ls -A /var/cpanel/users`;chown -R $CPAccess.$CPAccess /home/$CPAccess/public_html

    This is what I got:

    bash: alexsung: command not found
    chown: `.': cannot omit both user and group

    I guess it stoped at the first user, and tried to execute the username as a filename.

    Maybe I am just dumb, but could you place the Exact command line on a seperate line so I can tell if I am copy/paste it right in the first place? Thanks!
     
  12. rix

    rix Well-Known Member

    Joined:
    May 1, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    the command should look like this
    Code:
    root@host [~]# for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:$CPAccess /home/$CPAccess/public_html; done
    
    not like this
    Code:
    root@host [~]# `ls -A /var/cpanel/users`;chown -R $CPAccess.$CPAccess /home/$CPAccess/public_html
    
    to make things clear, can you copy and paste from the ssh window what you've type?
     
  13. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    Yes. Thanks, apparently I was just being dumb, and I left out a part of the copy/paste. Sorry for the troubles, but thanks for clarifying for just another dumbass :D :D
     
  14. rix

    rix Well-Known Member

    Joined:
    May 1, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Well im sorry i didn't explain it that well. Its good to hear that you've got it fixed. :D
     
  15. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    I just used this to restore from a failure, and it didnt work properly for me.

    The command worked fine, but what happened didnt work to expectations.

    It seems that it is just picking random people out of the users list and applying them to the wrong users home directory, so that the user who owns it, and the user is supposed to own it dont match up.
     
  16. damainman

    damainman Well-Known Member

    Joined:
    Nov 13, 2003
    Messages:
    515
    Likes Received:
    0
    Trophy Points:
    16
    is this not the same as /scripts/chownpublichtmls ??
     
  17. B12Org

    B12Org Well-Known Member

    Joined:
    Jul 15, 2003
    Messages:
    692
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Seattle Washington
    cPanel Access Level:
    Root Administrator
    Is there something I can run or do to do the same for the trash folder? If I just sub .trash for the folder it doesnt run, just takes me to a "> " Prompt.
     
  18. kalitebil

    kalitebil Member

    Joined:
    Jun 30, 2003
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    malatya/turkey
    [/]# for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess.$CPAccess /home/$CPAccess/public_html; done
    ide0(3,2): warning, user block quota exceeded.
    ide0(3,2): warning, user block quota exceeded.
    --
    what is this?
     

Share This Page