Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2006
    Posts
    159

    how to change all user cpanel password

    Hi

    how to change all user cpanel password in one time using SSH or WHM ?

    I have more than 250 user in server its deficit to change one by one

  2. #2
    Join Date
    Nov 2010
    Location
    Arizona
    Posts
    297
    You can automate this using the password change script in /scripts but there is no mass change fetaure in whm.

  3. #3
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    8,910
    Assuming you want to change the password for everyone to the same password which is a terrible idea, but I won't lecture you on that:

    1. Get a list of all users based on the /home directory:

    la -la /home | awk '{print $3}' | grep -v root | grep -v wheel | grep -v cpanel | grep -v apache >> users.txt

    2. Open users.txt and remove any users you do not want to modify. Also make sure there is no whitespace at the top of the file.

    3. Create a shell script with the following:

    #!/bin/sh
    for i in `more users.txt `
    do
    echo $i
    /scripts/chpass $i NEWPASSWORD
    done


    4. Run the shell script and it will change the password to every user in users.txt to NEWPASSWORD ... change that to something else, obviously. I've tested it out and it works as it should, but I'm not responsible if it breaks anything. :]
    Patrick William | RACK911 Labs | Software Security Auditing
    400+ Vulnerabilities Found - Quote @ https://www.RACK911Labs.com

    www.HostingSecList.com - Security notices for the hosting community.

  4. #4
    Join Date
    Mar 2006
    Posts
    159
    Quote Originally Posted by Patrick View Post
    Assuming you want to change the password for everyone to the same password which is a terrible idea, but I won't lecture you on that:

    1. Get a list of all users based on the /home directory:

    la -la /home | awk '{print $3}' | grep -v root | grep -v wheel | grep -v cpanel | grep -v apache >> users.txt

    2. Open users.txt and remove any users you do not want to modify. Also make sure there is no whitespace at the top of the file.

    3. Create a shell script with the following:

    #!/bin/sh
    for i in `more users.txt `
    do
    echo $i
    /scripts/chpass $i NEWPASSWORD
    done


    4. Run the shell script and it will change the password to every user in users.txt to NEWPASSWORD ... change that to something else, obviously. I've tested it out and it works as it should, but I'm not responsible if it breaks anything. :]
    Gr8
    Thank you

  5. #5
    Join Date
    Jun 2002
    Location
    Portsmouth, VA
    Posts
    161
    ok, yes, this is a dead thread, but, I recently found a need for this and used the info from this thread and another process to reset all the passwords on a server to a different random string and track them in a file.

    You still need to run this

    ls -la /home | awk '{print $3}' | grep -v root | grep -v wheel | grep -v cpanel | grep -v apache >> users.txt

    first and edit the file because there will almost certainly be white space at the top. And you can remove the users you don't need to change passwords for. Then run this script:

    #!/bin/bash
    str0="$$"
    for i in `more users.txt `
    do
    POS=2
    LEN=8 # Make password 8 characters.
    str1=$( echo "$str0" | md5sum | md5sum )
    randstring="${str1:$POS:$LEN}"
    let str0=str0+5
    echo "$i $randstring" >> newpass.txt
    /scripts/chpass $i $randstring
    done
    ---
    Jon Berry
    Proactive Server Management
    http://www.got-management.com

  6. #6
    Of course there is the password aging feature.
    You can just artifically over age everyone's password, so the next time they login, it has to be changed.
    This way you don't have several hundred "I can't login" requests and blocked IP requests.
    Chris Walker
    http://www.siterack.net
    Shared Hosting / Master Reseller / Reseller / HostReady cPanel VPS / DynaServer Adjustable VPS

  7. #7
    Join Date
    Mar 2010
    Location
    Scotland/United Kingdom
    Posts
    32
    In whm under account features i believe there's a force password change which means that when a user logs in they are prompted with a change pasword screen. I think its in WHM >> Account Functions >> Force Password Change

  8. #8
    Join Date
    Nov 2001
    Location
    Dublin, PA
    Posts
    192
    Quote Originally Posted by GOT View Post
    ok, yes, this is a dead thread, but, I recently found a need for this and used the info from this thread and another process to reset all the passwords on a server to a different random string and track them in a file.

    You still need to run this

    ls -la /home | awk '{print $3}' | grep -v root | grep -v wheel | grep -v cpanel | grep -v apache >> users.txt

    first and edit the file because there will almost certainly be white space at the top. And you can remove the users you don't need to change passwords for. Then run this script:

    #!/bin/bash
    str0="$$"
    for i in `more users.txt `
    do
    POS=2
    LEN=8 # Make password 8 characters.
    str1=$( echo "$str0" | md5sum | md5sum )
    randstring="${str1:$POS:$LEN}"
    let str0=str0+5
    echo "$i $randstring" >> newpass.txt
    /scripts/chpass $i $randstring
    done
    You can get a list of users by:
    cat /etc/domainusers|awk -F: '{print $1}'

  9. #9
    Join Date
    Mar 2003
    Location
    California USA
    Posts
    13,290
    These methods do not correctly sync the ftp passwords nor do they change the mysql passwords for the actual system users.
    You should at least run 'Synchronize FTP Passwords' from inside WHM after running one of the solutions presented in this thread.

    From /scripts/chpass:

    Code:
    unless ( exists $ENV{'ALLOW_PASSWORD_CHANGE'} && $ENV{'ALLOW_PASSWORD_CHANGE'} ) {
        my $str = <<EOM;
    ERROR: $0
    Invocation changes only the system
    password and does not have any effect
    on other services associated with your
    cPanel account, including FTP, SSH,
    WebDAV, and FrontPage.  It is strongly
    encouraged for you to change the
    password via the WHM & cPanel
    interface. You can force a password
    change through this script by setting
    the environment variable
    'ALLOW_PASSWORD_CHANGE=1'.
    EOM
        print $str;
        exit;
    }
    Steven Ciaburri | Industry's Best Server Management - Rack911.com
    Software Auditing - 400+ Vulnerabilities Found - Quote @ https://www.RACK911Labs.com
    Fully Managed Dedicated Servers (Las Vegas, New York City, & Amsterdam) (AS62710)
    FreeBSD & Linux Server Management, Security Auditing, Server Optimization, PCI Compliance

  10. #10
    Join Date
    Jan 2013
    Posts
    386
    changing mass password from script is possible but problem is all password for all users remain same
    Enjoy life today, because yesterday is gone, and tomorrow is never promised.

  11. #11
    Join Date
    Aug 2005
    Location
    Egypt
    Posts
    110
    GNU/Linux system Engineer
    Contact Me: 00201003338749

Similar Threads

  1. How to change password for user
    By 3-rx in forum Hosting Security and Technology
    Replies: 5
    Last Post: 10-07-2008, 08:18 AM
  2. password of user on MySQL 4.0.26 change to !!
    By somkiat999 in forum Web Hosting
    Replies: 2
    Last Post: 03-27-2006, 06:53 PM
  3. Change user password in webmail.
    By Ibanez in forum Hosting Security and Technology
    Replies: 2
    Last Post: 04-19-2003, 07:44 AM
  4. Cannot delete a user/change password/add user
    By BooBoo in forum Dedicated Server
    Replies: 0
    Last Post: 11-13-2002, 06:53 PM
  5. Web user change password
    By brightds in forum Web Hosting
    Replies: 0
    Last Post: 11-16-2001, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •