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!

UAPI::Ftp:passwd

Discussion in 'cPanel Developers' started by weeming21, Jun 13, 2015.

  1. weeming21

    weeming21 Active Member

    Joined:
    Jun 13, 2015
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Malaysia
    cPanel Access Level:
    Root Administrator
    I want to create a hook that prevent password change on certain ftp user
    like example if the ftp user is admin, then stop the passwd event

    how can i stop the passwd event?
    can i modify the stdin user input at pre stage, to fix the password for certain username?

    PHP:
    if($input['data']['args']['user']=='admin')
    {
          die(
    "BAILOUT You are not allow to change this ftp password!");
    }
    Code:
    [2015-06-13 16:42:18 +0800] info [uapi] ---debug_hooks---
    [2015-06-13 16:42:19 +0800] info [uapi]  msg: Beginning execution of script hook.
    [2015-06-13 16:42:19 +0800] info [uapi]  context: Cpanel::UAPI::Ftp::passwd
    [2015-06-13 16:42:19 +0800] info [uapi]  stage: pre
    [2015-06-13 16:42:19 +0800] info [uapi]  point: main
    [2015-06-13 16:42:19 +0800] info [uapi]  id: sXSUgwQJiV142RAk83RChHon
    [2015-06-13 16:42:19 +0800] info [uapi]  hook: /usr/local/cpanel/scripts/preftp
    [2015-06-13 16:42:19 +0800] info [uapi]  escalateprivs: 1
    [2015-06-13 16:42:19 +0800] info [uapi]  weight: 500
    [2015-06-13 16:42:19 +0800] info [uapi]  rollback: /usr/local/cpanel/scripts/postftp
    [2015-06-13 16:42:19 +0800] info [uapi]  data: {"user":"abc","args":{"cache_fix":"1434184798776","pass":"g#3old0FWe~I","user":"sales"},"result":null}
    [2015-06-13 16:42:19 +0800] info [uapi] STDOUT output from hook: /usr/local/cpanel/scripts/preftp
    [2015-06-13 16:42:19 +0800] info [uapi] BAILOUT You are not allow to change this ftp password!
    [2015-06-13 16:42:19 +0800] info [uapi] End STDOUT from hook
    [2015-06-13 16:42:19 +0800] warn [uapi] An exception was thrown in the hook /usr/local/cpanel/scripts/preftp for Cpanel::UAPI::Ftp::passwd at /usr/local/cpanel/Cpanel/Hooks.pm line 67
      Cpanel::Hooks::hook(HASH(0x56fc3e8), HASH(0x56fc740)) called at /usr/local/cpanel/Cpanel/EventHandler.pm line 197
      Cpanel::EventHandler::_uapi_std_hook(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, Cpanel::Args=HASH(0x56fc508), Cpanel::Result=HASH(0x56fbed8), __CPANEL_HIDDEN__) called at /usr/local/cpanel/Cpanel/EventHandler.pm line 165
      Cpanel::EventHandler::pre_api(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, Cpanel::Args=HASH(0x56fc508), Cpanel::Result=HASH(0x56fbed8)) called at /usr/local/cpanel/Cpanel/API.pm line 102
      Cpanel::API::execute(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, HASH(0x56fbef0)) called at /usr/local/cpanel/Cpanel/API.pm line 432
      Cpanel::API::run_api_mode(HASH(0x56fbef0)) called at uapi.pl line 288
      main::script() called at uapi.pl line 89
    
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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