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.

FTP-Only Packages

Discussion in 'Data Protection' started by markb14391, Jul 12, 2008.

  1. markb14391

    markb14391 Well-Known Member

    Joined:
    Jun 9, 2008
    Messages:
    305
    Likes Received:
    2
    Trophy Points:
    18
    Hi All,

    I will be selling VPSs (among other things), and I would like the ability to offer VPS clients the chance to buy an add-on FTP account for backing up their virtual server. (We use HyperVM as the VPS control panel, and it does have the ability to backup to remote FTP servers.)

    A few questions:

    1. Could I achieve this kind of package (an FTP-only account) in cPanel/WHM using the Features Manager (by basically turning off everything non-FTP related)? If so, would this cause any technical issues?
    2. Could such a package be hosted without a domain? These users would simply need access to an FTP account.
    3. Does anyone know if WHMCS could handle this kind of thing as an add-on? For example, while
    ordering the VPS package people could also order the FTP backup add-on?

    Thanks!
     
  2. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    Creating an account to use for 1 FTP account would create a UNIX system user for that account as well. It's unlikely that you'd want to create a system user rather than a simple virtual FTP user to give them access.

    Why not set up a domain that all your accounts can backup to like myhostbackups.com and then provision out virtual ftp users for that domain. You can create a virtual FTP use through the XML API by sending this request:

    https://IP:2087/xml-api/cpanel?user=$cpuser&xmlin=<cpanelaction><module>Ftp</module><func>addftp</func><apiversion>1</apiversion><args>$user</args><args>$password</args><args>$homedir</args><args>$quota</args></cpanelaction>

    where the variables are as follows:

    $cpuser - cPanel username that owns the domain the FTP account is associated with
    $user - username for the FTP account
    $password - password for the FTP Account
    $quota - disk space quota for the FTP account (in MB)
    $homedir - top level directory the FTP account has access to


    Alternatively, you could create a system account for the FTP user that has the same username as their cPanel account (if the FTP account is on a different server) by creating a cPanel account with a fake domain name and then using the feature manager to turn off all icons/menus except the FTP functions.


    If you wanted to backup to the same server but use the virtual FTP user method, you could add a hook to automatically create the virtual FTP user for certain packages by adding a /scripts/postwwwacct file on your system (see documentation at http://www.cpanel.net/support/docs/hooks.htm#postwww) that calls the XML API to add the ftp account. You can get the XML API connection data from http://www.mybrandedhost.com/hosting-docs.html which is our example site for automation.

    Code:
    #!/usr/bin/perl
    
    require '/root/ServerConfig.pm';  
    
    my %OPTS = @ARGV;
    
    my $cpuser = 'myhostb';  #the cPanel user for myhostbackups.com
    my $user = $OPTS{'user'} . '\@myhostbackups.com'; # Username is $user@myhostbakcups.com
    my $homedir = $OPTS{'user'};     #Store backups in /home/myhostb/$user
    my $quota = '5000';        #5000 MB Disk Space Quota
    
    
    
    if ( $OPTS{'plan'} =~ /vpswithftp/){
         my $username = shift;  
         my $requestline = '/xml-api/cpanel?user=$cpuser&xmlin=<cpanelaction><module>Ftp</module><func>addftp</func><apiversion>1</apiversion><args>$user</args><args>$password</args><args>$homedir</args><args>$quota</args></cpanelaction>';  
        my %userrequest = $ServerConfig::xmlapi_object->dispatch($requestline);  
    }
    

    This method is obviously more difficult than adding a new cPanel account with all features disabled except FTP but it doesn't add a new system user for each FTP account.


    Another sugestion is that you might want to look into a remote backup solution like R1Soft's CDP. With CDP, backups are stored on a remote server and users can restore them through a web interface that appears in their cPanel interface.
     
  3. markb14391

    markb14391 Well-Known Member

    Joined:
    Jun 9, 2008
    Messages:
    305
    Likes Received:
    2
    Trophy Points:
    18
    Wow, thank you!

    I'm new to the automation part of it...can any of this be linked to WHMCS, or is it all proprietary to cPanel alone?

    I guess I mean...is WHMCS capable of supporting the add-on hooks to accomplish what you suggested? I assume yes, and I'll dig into the docs.

    Thanks! That is great stuff.
     
  4. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    This could be added into the WHMCS interface in theory but I'd likely talk to WHMCS about getting something like that added. I'm not sure if they have a section for custom modules or not. In theory though, you could run that code from any server you want as it can remotely connect to the WHM machine from anywhere.
     
Loading...

Share This Page