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.

Suspend Multiple Accounts

Discussion in 'Workarounds and Optimization' started by EstebanC, Mar 5, 2008.

  1. EstebanC

    EstebanC Member

    Joined:
    Jul 1, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hi!

    I need to know if exist any way to suspend multiple accounts from WHM?

    If not, how can I suggest the idea to the CPanel development team?

    Thanks!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This functionality is not currently available in the WHM interface. There is already a feature request for this functionality in our official feature request system that you can vote on:

    http://bugzilla.cpanel.net/show_bug.cgi?id=2564
     
  3. Arhineus

    Arhineus Well-Known Member

    Joined:
    Nov 1, 2005
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    You should be able to do this via SSH, however I can't say that I've ever tried.
     
  4. shital

    shital Member

    Joined:
    May 28, 2007
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Take your list of users that need to be suspended.

    Yo can write a little shell script i.e.

    pico test1.sh

    add the following lines:

    /scripts/suspendacct user1
    /scripts/suspendacct user2
    .
    .
    .
    .
    .
    Then save and change file permission to 755 run the file.

    **NOTE: Replace "user1, user2, etc" with the actual usernames.
     
  5. eurorocco

    eurorocco Well-Known Member

    Joined:
    Jun 23, 2003
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    Perl script to see, suspend or unsuspend

    Put the text into a text file like resellersuspend.pl , then chmod u+x resellersuspend.pl , then run with the reseller cpanel username and -what, -go or -unsuspend. -what is to see what accounts it is to suspend without doing anything, just to check the script is going to do the right thing before pulling the trigger...

    #!/usr/local/bin/perl

    @ARGV == 2 || die "usage: $0 reseller (-what|-go|-unsuspend)\n";

    $reseller = shift(@ARGV);
    $what = shift(@ARGV);

    $infile = '/etc/trueuserowners';
    open(INF,"<$infile") || die "cannot open $infile\n";
    @lines = <INF>;
    close(INF);

    @lines = grep(/\:\s$reseller$/,@lines);
    chomp(@lines);

    foreach $line (@lines){
    ($acct,$reseller) = split(/\:/,$line);
    print "/scripts/suspendacct $acct\n";

    if($what eq "-go"){
    system("/scripts/suspendacct $acct");
    }
    elsif($what eq "-unsuspend"){
    system("/scripts/unsuspendacct $acct");
    }
    }
     
  6. dstana

    dstana Registered

    Joined:
    Jul 6, 2016
    Messages:
    3
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Phoenix, AZ
    cPanel Access Level:
    Root Administrator
    I'm late to this thread, but it looks like cPanel still hasn't implemented a bulk account suspension yet. I needed to suspend almost 200 accounts on our server and this thread gave me the idea for a shell script I wanted to share with others looking for an easy solution.

    1. Create a text file with each domain for suspension on each line and save it as 'domainlist'

    2. Create another file (suspendscript) with the following contents:

    Code:
    #!/bin/bash
    
    touch userlist
    while read line; do
       grep $line /etc/domainusers | cut -d: -f1 >> userlist
    done < domainlist
    
    while read user; do
       /scripts/suspendacct $user
    done < userlist
    
    rm -f userlist
    echo "The requested accounts have been suspended."
    
    --Save this file in the same folder as 'domainlist'.

    3. run
    Code:
    chmod +x suspendscript
    4. Then ./suspendscript
     
    cPanelMichael likes this.
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page