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.

change all user cpanel password

Discussion in 'General Discussion' started by mojamoi, Mar 19, 2011.

  1. mojamoi

    mojamoi Well-Known Member

    Joined:
    Jul 23, 2007
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    how to change all user cpanel password for 300 users in one time using SSH or WHM ?

    any simple script
     
  2. MattLee

    MattLee BANNED

    Joined:
    Aug 26, 2009
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    There is not a method within cPanel or WHM to mass change account passwords. This would more than likely need to be done manually by you on an account by account basis unless you feel comfortable enough writing a script that utilizes the 'passwd' command in a loop for every user on the server.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    I wanted to further mention that if you use passwd, it doesn't sync up the FTP passwords for the users either, so you should instead be calling the following to change the passwords:

    Code:
    /scripts/realchpass username password
    Additionally, this script does not handle the MySQL password any longer and you then need to call this script to change the MySQL password for the user:

    Code:
    /scripts/mysqlpasswd username password
    For both of the above examples, username is the cPanel username and password is the MySQL password.

    Again, to re-iterate, please do not use passwd for changing passwords, the cPanel and FTP passwords are handled by /scripts/realchpass and the MySQL passwords are handled by /scripts/mysqlpasswd scripts. If you use passwd, then only the cPanel password will change and not be synced with the FTP or MySQL passwords. If you use only /scripts/realchpass, then the MySQL password won't be changed. You must use both scripts to get the password changed for all 3 services.

    Thanks.
     
  4. gkgcpanel

    gkgcpanel Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    217
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    FYI: This alone will not work. I ran /scripts/realcphass username password for a bunch of accounts that were compromised via FTP. But afterwards was still able to log in with the old password. Not until I went into WHM and ran "Synchronize FTP Passwords" did it work. After that the old password no longer worked, and the new one did.

    Posting this in case anyone else runs into this problem.
     
  5. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In addition, you can force cPanel users to change their own passwords by clicking, in the WebHost Manager, Main >> Account Functions >> Force Password Change. You can use this to force some or all cPanel users to change their passwords the next time they log in.
     
  6. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    i have same question and found script "/usr/local/cpanel/scripts/realchpass"
    Can this help for changing all passwords for user?

    and script for changing will be something like:

    1. take all usernames in one file
    2. change passwords:
    Code:
    #!/bin/sh
    for i in `more list.txt `
    do
    echo $i
    /scripts/chpass $i NEWPASSWORD
    done
    only, i want random passwords, so for now this script is not finish, i will add variable for newpassword to "take" passwords from file.


    So, question, can i use "/usr/local/cpanel/scripts/realchpass" to change users passwords?




    thank you.
     
    #6 vmicovic, Aug 2, 2012
    Last edited: Aug 2, 2012
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,774
    Likes Received:
    663
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, this script is the same one that Tristan mentioned above. The only difference is the path to the script.

    Thank you.
     
  8. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    thank you for answer.
    Last question, did i must after realchpass to use /scripts/mysqlpasswd ?
    and after changing must do ftp sync with script "/scripts/ftpupdate"
     
    #8 vmicovic, Aug 2, 2012
    Last edited: Aug 2, 2012
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,774
    Likes Received:
    663
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, you must use "/scripts/mysqlpasswd" to ensure the MySQL password is changed. The FTP password is updated when you use "/scripts/realchpass".

    Thank you.
     
  10. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    hmm, i don`t understand which sql password he change with that script?
    and when i change with realchpass he only change for cpanel, not for ftp, so then i do "/scripts/ftpupdate" and all pass ok.

    tomorrow i will put script, if someone need it.
     
  11. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    here is new script:
    Only left Michael to tell us, is recommend to use mysqlpasswd at the end.
     
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,774
    Likes Received:
    663
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, you should use "/scripts/mysqlpasswd" because it ensures the MySQL password for the account username is updated. Otherwise, the user will encounter authentication errors when attempting to access PHPMyAdmin from within their cPanel.

    Thank you.
     
Loading...

Share This Page