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.

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:
    1
    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 cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
Loading...

Share This Page