[FEATURE REQUEST] Get the Linux username created in the response for CyberPanel API or CLI calls

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 [email protected] --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'=>'[email protected]'), '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.

Sure, please create a github request for it, I can add this username in response to the api call.

Please create a github request and we can get it done then.

Thank you very much. I created the feature request here.

Also, what is the password set for this newly created Linux user? The password I input for the CyberPanel user doesn’t work with the Linux user, so I have to do “passwd [linuxusername]” as root to set the password.

Is there a password set that can also be returned by the response as part of the feature request (I don’t know if that would be a security issue)? Or, does one need to set a password as the root user using passwd? Thank you.

I’ve returned this value as ‘LinuxUser’ when you call this end-point → CyberPanel Cloud API

See here → fix https://github.com/usmannasir/cyberpanel/issues/1035 · usmannasir/cyberpanel@ee3e179 · GitHub

If website creation is success you will get its LinuxUser in response.

BTW: CyberPanel users are not linux users, each website have its own linux user and one CyberPanel user can have as many sites and all of those sites have different underlaying linux users.

If you want to change password of that linux user from CyberPanel you can use

/websites/<domain.com>/sshAccess

Right now there is no API call for this, but can be made if needed.

PS: I added this feature right now in v2.3.4-dev

thanks

1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.