Command line option to list suspended accounts/domains – cPanel

In WHM/cPanel server there is an option to suspend a particular account/domain for a particular period. This option is very helpful to deactivate an account if we found any malicious activities like spamming, phishing etc from that account. Also you can suspend an account if there any payment related issues. So suspending and un suspending accounts are important if you are running a hosting business.

Here I am explaining different ways to suspend, un-suspend and list suspended accounts in a server with cPanel. You can either do these things from the WHM control panel or from the server cli [command line interface] as root user.

How to suspend/unsuspend an account via WHM panel?

From the WHM control panel the server admin can simply manage the account suspension and re-activation. Here is the steps for suspending an account via WHM.

Step I : Login to WHM panel.
Step II : Go to:

Home >> Account Functions >> Manage Account Suspension

From there you can select the account and suspend it simply. There is an option to add your note for suspension reason and also you can prevent re-sellers from un-suspending the account from their WHM panel. See the image below for more details.

suspend1

You can also un-suspend an account from here. So it’s simple to manage these things from the WHM control panel. You do not need a super power to do these stuffs from the panel. Really simple!!

How to suspend/unsuspend an account via command-line?

Backend scripts are available to do the same in a WHM/cPanel server. We can simply suspend and un-suspend accounts via command-line using those cPanel scripts. Here I am listing those scripts for suspending and un-suspending cpanel accounts.

To suspend an account:

/scripts/suspendacct user-name

To unsuspend an account:

/scripts/unsuspendacct user-name

How to list suspended accounts from the WHM panel?

At the section where you managing the suspention of an account, you can see that already suspended account is shaded with red color. In WHM there is a direct option to list all suspended accounts. Do follow the below pasted steps for that.

Step I : Login to WHM panel.
Step II : Go to:

Home >> Account Functions >> List Suspended Accounts 

If you want, you can unsunpend accounts from there directly.

How to list suspended accounts from comman-line?

Here we goes to our topic “command line option to list suspended accounts/domains“. Yes, from the back-end we can simply list suspended accounts by accessing the directory “/var/cpanel/suspended/“. All suspended accounts will be listed there. That’s a file and you can find the reason from reading the content on that file with username. That’s it..

Example:

# ll /var/cpanel/suspended
total 72
drwxr-xr-x   2 root root  4096 Jul 24 13:03 ./
drwxr-xr-x. 86 root root 12288 Jul 24 13:09 ../
-rw-r--r--   1 root root    54 May  6 18:30 user1
-rw-r--r--   1 root root     0 Mar 22 23:01 user2
-rw-r--r--   1 root root    54 May  6 18:30 user3
-rw-r--r--   1 root root    54 May  6 18:30 user4
-rw-r--r--   1 root root    54 May  6 18:30 user5
-rw-r--r--   1 root root   152 Jul 24 13:03 user6
-rw-r--r--   1 root root     0 Jun 11 10:04 user7
-rw-r--r--   1 root root    54 May  6 18:30 user8
-rw-r--r--   1 root root    54 May  6 18:30 user9

Cool πŸ˜€

Related Links:
Get a list of re-sellers’ name under your WHM/cPanel server – Command-line option
Get a list of total cPanel users under a specific re-seller via command line
Possible root compromise detected

Shutdown your test infra and reduce cost – AWS

There should be a lot of services or instances that we can shutdown for many hours in a day. Consider your production infra contains 10 large type EC2 instances and your organisation have 2 QA and 1 test environment of exactly same number of instances and services like your running production infra.

We can not stop the productions tings to save money. However, if you want to reduce your monthly billing, you can do something with your QA and Test infra. Read more…

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

11 thoughts on “Command line option to list suspended accounts/domains – cPanel

  1. Your command line are not correct. It should be:

    /scripts/suspendacct USERNAME
    /scripts/unsuspendacct USERNAME

    Cheers! πŸ™‚

    1. I would also like to add that you could also save notes to the suspension so that when you grep the user you never have to guess why it was suspended in the first place.

      /scripts/suspendacct USERNAME ‘Reason’ 1

      You’ll always wanna lock down the account to prevent a reseller setup from unsuspending on their own which is why you add the 1 at the end.

  2. Thanks for the great articles,
    with command ll /var/cpanel/suspended we can only show list of suspend account, as we can see with whm list suspend account the reason of the suspension
    do you know how to list suspend account with command line that show also reason of suspension ?
    Thanks in advance

    1. Idk from WHM UI but from CLI

      grep -w “reseller” /etc/trueuserowners | cut -d : -f 1 | while read n; do /scripts/suspendacct $n;done

Leave a Reply

Your email address will not be published. Required fields are marked *