Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    8

    Question (SOLVED) Able to terminate all accounts on server?

    Hello, I currently have a server with over 1000 cPanel accounts on it and I wish to terminate all of them if possible. I tried using the Terminate Multiple Accounts option in WHM but haven't had any luck (it times out when I try to do more than 20 accounts or so) and it freezes my browser for a few minutes when clicking a handful of checkboxes. Is there an easy method to terminate all of the accounts without doing a fresh install?
    Last edited by kujoez; 07-06-2009 at 07:58 PM. Reason: Solved.

  2. #2
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    From the shell, /scripts/killacct (username)

    The following could do some pretty nasty damage to a server
    but fortunately it must be executed as root to actually work
    but even still I am a little leary to post this below but since
    you asked, a small script to kill all accounts on the server
    at once and bypass the normal approval prompting:

    DO NOT EXECUTE THIS SCRIPT IF YOU DO NOT WANT TO
    WIPE THE ENTIRE SERVER CLEAN OF CPANEL ACCOUNTS AND
    YOU ARE ADVISED TO FIRST MAKE GOOD BACKUPS!


    Code:
    #!/bin/bash
    IFS="$"
    
    ls /var/cpanel/users | while read KUSER; do
      echo 'y' | /scripts/killacct ${KUSER}
    done
    Note that depending on the size of the files in the accounts and or activity logfiles,
    some accounts may take longer than others to delete and may not necessarily be
    hung but just regular processing deleting large accounts. That said, you stand a
    much better chance of things working from the shell than from the WHM interface
    when talking about such a large task as deleting 1000 accounts at once.
    Last edited by Spiral; 07-06-2009 at 02:20 PM.

  3. #3
    Member
    Join Date
    Jul 2009
    Posts
    8

    Default

    Thanks for the reply! The server in question is my old server and all of the accounts were backed up before and after they were migrated to the new server.

  4. #4
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Wink

    Quote Originally Posted by kujoez View Post
    Thanks for the reply! The server in question is my old server and all of the accounts were backed up before and after they were migrated to the new server.
    Then have fun! I've used the simple script above to wipe out quite a few
    old servers after migrations so that should take care of it for you.

    Basically just reads in the list of cpanel accounts from the system and
    executes a killacct against each login name ... simple as that!

    Nice thing is if for some odd reason the wipe process hangs anywhere,
    you'll pickup where you left off when you start the script again and
    don't have to redo any previous account deletions because once
    an account is deleted, they will no longer be read as a valid cpanel login
    the next time the script is executed.
    Last edited by Spiral; 07-06-2009 at 02:33 PM.

  5. #5
    Member
    Join Date
    Jul 2009
    Posts
    8

    Default

    Very nice. I'm glad I executed it from my home server because this looks like it will take a while.

  6. #6
    Member
    Join Date
    Jul 2009
    Posts
    8

    Default

    Wow! Took almost 6 hours!

Similar Threads & Tags
Similar threads

  1. Replies: 3
    Last Post: 04-19-2010, 03:14 PM
  2. Unable to terminate accounts
    By Brammeke in forum New User Questions
    Replies: 1
    Last Post: 09-18-2006, 08:18 AM
  3. How to mass terminate accounts??
    By Juliet in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 08-21-2005, 05:43 PM
  4. Terminate Accounts Function
    By BobbyDouglas in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 01-30-2005, 07:20 PM
  5. Mass Terminate Accounts
    By sodapopinski in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 02-24-2003, 01:45 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube