How to create FTP account automatically when website created

Hi Guys,

I’m trying to find which file I should be editing to achieve my goal of creating ftp accounts automatically after new website created.

I found cyberPanel.py for create website function but I didnt understand how does it communicate to create websites

def createWebsite(self, package, owner, domainName, email, php, ssl, dkim, openBasedir):
    try:

        externalApp = "".join(re.findall("[a-zA-Z]+", domainName))[:7]
        phpSelection = 'PHP ' + php

        result = virtualHostUtilities.createVirtualHost(domainName, email, phpSelection, externalApp, ssl, dkim,
                          openBasedir, owner, package, 0)

        if result[0] == 1:
            self.printStatus(1,'None')
        else:
            self.printStatus(0, result[1])

    except BaseException as msg:
        logger.writeforCLI(str(msg), "Error", stack()[0][3])
        self.printStatus(0, str(msg))

I’m trying to add this there some how

cyberpanel createFTPAccount --domainName cyberpanel.net --userName cyberpanel --password cyberpanel --owner admin

IS that the right place to start digging or should I look for some other location to understand how new website creation function works on CyberPanel

Many thanks for any input.

Were you able to develop this?

This should work via SSH command line, or a shell script that you can run automatically via ssh. But I’m not sure how you would get this to run automatically if you create a site via the CyberPanel GUI.