When I use the CyberPanel API:
Or CyberPanel CLI:
To create a new website account, it creates one with a username like, “somed5075”. Is there any way for me to capture this username in an automated way during the account creation process?
For instance if with the CLI I do:
cyberpanel createWebsite --package Default --owner admin --domainName cyberpanel.net --email test@test.com --php 8.1.2
This outputs:
{“success”: 1, “errorMessage”: “None”}
This creates a CyberPanel account under the user admin, but the Ubuntu username associated with the /home/cyberpanel.net folder is “cyber7695”. And this is the user name that I have to use if I want to access the folder in SSH.
And if using the CyberPanel API I do:
$cyber = new CyberApi();
$params = array('serverusername'=>'admin', 'serverpassword'=>'[password]', 'serversecure'=>TRUE, 'serverhostname'=>'[xxx.xxx.xxx.xxx]', 'serverport'=>'8090');
$params_more = array('domain'=>'somedomainname.com', 'clientsdetails'=>array('email'=>'some@email.com'), 'configoption1'=>'Default', 'username'=>'somedoma', 'password'=>'[password]', 'configoption2'=>'user');
$params = array_merge($params, $params_more);
$result = $cyber->create_new_account($params);
print_r($result);
This outputs:
Array ( [status] => 1 [createWebSiteStatus] => 1 [error_message] => None [tempStatusPath] => /home/cyberpanel/7881 )
Then this creates a CyberPanel user ‘somedoma’, but the Ubuntu username is ‘somed5075’. And for SSH, the user ‘somedoma’ does not work, but the user ‘somed5075’ does work.
In the success messages, I don’t see this username. Is there any way to capture this username in automated fashion as the API or CLI are being used?
I would like to use the API or CLI to automate the creation of an account and the uploading of some files to that account, but currently I’m having to manually check the username that was created by the script. I was hoping there was some automated way to capture this username so that I could make the whole process of creating the account and using SSH to upload files automated.