Description

This function lists an account's FTP users.


We strongly recommend that you use the following UAPI function instead of this function:

Examples 




https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_func=listftp



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List the account's FTP users.
$list_ftpusers = $cpanel->api2(
    'Ftp', 'listftp'
);

 



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List the account's FTP users.
my $list_ftpusers = $cpliveapi->api2(
    'Ftp', 'listftp',
);

 




cpapi2 --user=username Ftp listftp



{
  "cpanelresult": {
    "apiversion": 2,
    "func": "listftp",
    "data": [
      {
        "user": "user",
        "type": "sub",
        "homedir": "/home/example/public_html/user"
      },
      {
        "user": "example",
        "type": "main",
        "homedir": "/home/example"
      },
      {
        "user": "example_logs",
        "type": "logaccess",
        "homedir": "/usr/local/apache/domlogs/example"
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Ftp"
  }
}



Parameters

This function does not accept parameters.

Returns

Return TypeDescriptionPossible valuesExample
userstringThe FTP username.A valid email address.example
typestringThe type of FTP account.
  • main — This is the main FTP account.
  • sub — This is a sub-user FTP account.
  • logaccess — This account is for logfile access.
                main
              
homedirstringThe path to the account's home directory.A valid absolute path./home/example
reasonstring

A reason for failure.

This function only returns a reason value if it failed.


A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1