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.

addftp API2 call failing - "Failed to determine FTP account xxxx directory"

Discussion in 'cPanel Developers' started by filmotheklown, Apr 5, 2011.

  1. filmotheklown

    filmotheklown Member

    Joined:
    Oct 3, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    My call to the addftp xmlapi just failed and I can't figure out why:

    It has been working up until today.

    Here's the result dump (from php). "USERNAME" is substituted for the user name we were trying to assign a ftp account to. I've tried a couple different usernames/passwords, same results.
    Code:
    Array
    (
        [cpanelresult] => Array
            (
                [data] => Array
                    (
                        [0] => Array
                            (
                                [result] => 0
                                [reason] => Failed to determine FTP account USERNAME directory.
                            )
    
                    )
    
                [event] => Array
                    (
                        [result] => 1
                    )
    
                [module] => Ftp
                [apiversion] => 2
                [func] => addftp
            )
    )
    If I look in the directory where it's attempting to create the user folder, it appears to have succeeded. The user folder is there and set 0755

    The user names and passwords I'm passing are also valid choices.

    WHM 11.28.87
    CENTOS 5.5 i686 standard

    ????
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi filmoftheklown,

    Can you place post a copy of either a snippet of PHP script (in which you are making you XML-API query) or the query URL with the parameters. It's like that there's some parameter keys that aren't being properly interpreted by the XML-API binary.

    (if you're using our XML-API PHP client class, you can retrieve that URL from the PHP error_log with you enable debugging, ie. $xmlapi->set_debug(1))

    Regards,
    -DavidN
     
  3. filmotheklown

    filmotheklown Member

    Joined:
    Oct 3, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Figured it out. cPanel API doesn't like it when you pass it a login in WordCase. Only seems to work in lowercase. Fixed the problem by using:

    $login = strtolower($login);

    Before executing the XMLAPI call.

    Didn't try entirely UPPERCASE login, but definitely did not like WordCase logins.

    PS: I had prior assumed that login could be either mixed case or uppercase as a valid parameter.
     
  4. solcre

    solcre Registered

    Joined:
    Apr 19, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I'm having the same problem it looks like it wants to create an annonymous account also... what the hell ?
     
  5. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I haven't tested the uppercase/mixedcase scenario, but it makes sense to me that all characters should be lowercase.

    Other points to consider when using API2 Ftp::addftp:

    1) If you're making the call remotely via the XML-API, make sure you're using a version of the PHP XML-API class that is version 1.0.6 or higher (if you're coding in PHP and wish to use this class), or at least make sure you observe the need to differentiate the URL parameters for the function versus the XML-API parser (essentially, use 'cpanel_xmlapi_user' or 'cpanel_jsonapi_user' to itemize the cPanel user account and 'user' to describe the new FTP account name [otherwise two key-pair values with the same key in the URL will get munged when processed by the XML-API parser])

    2) Ensure that the 'user' parameter for the Ftp::addftp function is simply the unique portion of the FTP login. i.e. if your domain is dave.com and you intend to FTP into you account using 'webdeveloper@dave.com' you should set the 'user' value to 'webdeveloper'...no @$domain

    3) API2 Ftp::addftp does not allow for periods (the "dot" character) in the 'user' value. If you need such a FTP username, for example 'web.developer', use the API1 equivalent which allows for that sort of fine-grained' validation.

    -DavidN
     
Loading...

Share This Page