Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

File Extension Checker: Suspend Account?

Discussion in 'cPanel Developers' started by sswords, Sep 3, 2011.

  1. sswords

    sswords Registered

    Joined:
    Sep 3, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Hi,

    I have a shell script which searches through each user's /public_html/ folder every morning at 3am to find "illegal" files (file extensions include: .tor, .nfo, .bz2, etc). This works fine, but how can I make it so if an "illegal" file is found, the account is suspended?

    Thanks.
     
  2. MattDees

    MattDees Well-Known Member

    Joined:
    Apr 29, 2005
    Messages:
    416
    Likes Received:
    1
    Trophy Points:
    243
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    There are two ways of doing this.

    One is by executing /scripts/suspendacct $user $reason, this is not recommended but may be useful if it is a bash script.

    If you are writing this in perl or PHP, you can use the suspendacct xml-api call with one of the libraries hosted on our github:

    https://github.com/cpanelinc
    SuspendAccount < SoftwareDevelopmentKit < TWiki

    and just ensure a /root/.accesshash file exists so that credentials can be loaded.


    I will state that you may want to be careful with some of those file extensions, .bz2 concerns me as there are some legitimate reasons to have a bz2 file extensions (alot of open source code is hosted in .bz2) as it is one of the better open-source compression algorithms.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice