Child pages
  • UAPI Functions - Ftp::add_ftp
Skip to end of metadata
Go to start of metadata

Description

This function creates an FTP account.

Important:

In cPanel & WHM version 76 and later, when you disable the FTP role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Ftp/add_ftp?user=weeones&pass=12345luggage&quota=42


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Create a new FTP user.
$new_ftp = $cpanel->uapi(
    'Ftp', 'add_ftp',
    array(
        'user'    => 'weeones',
        'pass'    => '12345luggage',
        'quota'   => '42',
    )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Create a new FTP user.
my $new_ftp = $cpliveapi->uapi(
    'Ftp', 'add_ftp',
    {
        'user'    => 'weeones',
        'pass'    => '12345luggage',
        'quota'   => '42',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Create a new FTP account. -->
[% execute( 'Ftp', 'add_ftp', { 'user' => 'weeones', 'pass' => '12345luggage', 'quota' => '42' } ); %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username Ftp add_ftp user=weeones pass=12345luggage quota=42



Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 

 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":null
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The new FTP account username.

A valid FTP username.

weeones
passstring

Required

The new FTP account password.

A secure password.12345luggage
homedirstring

The path to the FTP account's root directory.

If you do not specify this parameter, the FTP account uses the cPanel account's home directory.

The path to the FTP account's root directory, relative to the cPanel account's home directory.weeoneftp
quotainteger

The FTP account's quota.

This parameter defaults to 0.

  • An integer that represents the FTP account's maximum disk usage, in Megabytes (MB).
  • A value of 0 grants the FTP account unlimited disk space.
42
disallowdotBoolean

Whether to strip dots (.) from the username.

This parameter defaults to 1.

  • 1 — Strip dots.
  • 0 — Do not strip dots.
1
domainstring

The user's associated domain.

Note:

We introduced this parameter in cPanel & WHM version 54.

This parameter defaults to the cPanel account's primary domain.

A domain that the cPanel account owns.example.com
pass_hashstring

The account's password hash.

Note:

  • You can use this parameter in place of the pass parameter. However, you cannot use both pass and pass_hash parameters in the same request.
  • We introduced this parameter in cPanel & WHM version 54.
This parameter defaults to a blank string.

A valid password hash that uses your server's cryptographic hash function.

Note:

You can find your server's hash type in the /etc/sysconfig/authconfig file.

 Click to view...

$6$1sOyHP5ZDYp3pGUz$R0TSgfPRHfDjT5PP5RJGv39FhiGTNNPvM7IFpCBjXijMmlMZk9yI8T3LqGuntc9fdKb5eX.lGL7wBS9e4DAWn/

Returns

This function only returns metadata.