#1 (permalink)  
Old 07-06-2009, 02:03 PM
Registered User
 
Join Date: Jul 2009
Posts: 8
kujoez is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-06-2009, 02:14 PM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,535
Spiral is on a distinguished road
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.
__________________
[b][color="Blue"]Server Support[/color]: [color="Red"]Server consulting, security, and management![/color][/b]

Last edited by Spiral; 07-06-2009 at 02:20 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-06-2009, 02:21 PM
Registered User
 
Join Date: Jul 2009
Posts: 8
kujoez is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-06-2009, 02:25 PM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,535
Spiral is on a distinguished road
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.
__________________
[b][color="Blue"]Server Support[/color]: [color="Red"]Server consulting, security, and management![/color][/b]

Last edited by Spiral; 07-06-2009 at 02:33 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-06-2009, 02:52 PM
Registered User
 
Join Date: Jul 2009
Posts: 8
kujoez is on a distinguished road
Very nice. I'm glad I executed it from my home server because this looks like it will take a while.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-06-2009, 07:57 PM
Registered User
 
Join Date: Jul 2009
Posts: 8
kujoez is on a distinguished road
Wow! Took almost 6 hours!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
terminate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is so easy to terminate accounts? Kent Brockman cPanel and WHM Discussions 5 04-13-2008 10:57 AM
Multiple Terminate accounts hosteurolive cPanel and WHM Discussions 1 03-15-2007 08:20 AM
How to mass terminate accounts?? Juliet cPanel and WHM Discussions 6 08-21-2005 05:43 PM
Terminate Accounts Function BobbyDouglas cPanel and WHM Discussions 6 01-30-2005 07:20 PM
Mass Terminate Accounts sodapopinski cPanel and WHM Discussions 6 02-24-2003 01:45 AM


All times are GMT -5. The time now is 11:09 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc