CyberPanel Command Line Interface

Some people just love command line interface and can’t get their eyes of the terminal. We’ve now most of the CyberPanel functionality available via command line. Run cyberpanel -h for more details.

This gives you the power to develop your own applications on top of CyberPanel, with language choice of yours.


User Functions

1. Create User


cyberpanel createUser --firstName Cyber --lastName Panel --email [email protected] --userName cyberpanel --password securepassword --websitesLimit 10 --selectedACL user --securityLevel HIGH

Understanding Arguments

  • --websitesLimit - This option is used when selectedACL is set to reseller, but value must be set.

  • --selectedACL - It can be admin, reseller or user or any custom ACL created from CyberPanel.

  • --securityLevel - Can be either HIGH or LOW

2. Delete User


cyberpanel deleteUser --userName cyberpanel

3. Suspend User

Suspend a user


cyberpanel suspendUser --userName cyberpanel --state SUSPEND

Unsuspend a user


cyberpanel suspendUser --userName cyberpanel --state UNSUSPEND

4. Edit User


cyberpanel editUser --userName cyberpanel --firstName Cyber --lastName Usman --email [email protected] --password securepassword --securityLevel HIGH

Understanding Arguments


--securityLevel - Can be either HIGH or LOW

5. List Users

cyberpanel listUsers

This produces a JSON output.


{

   "status":1,

   "fetchStatus":1,

   "error_message":"None",

   "data":"[{\"id\": 3, \"name\": \"cyberpanel\", \"owner\": \"admin\", \"acl\": \"user\", \"diskUsage\": \"0MB\", \"websites\": 10, \"state\": \"SUSPENDED\"},{\"id\": 5, \"name\": \"cyberpanel1\", \"owner\": \"admin\", \"acl\": \"user\", \"diskUsage\": \"0MB\", \"websites\": 10, \"state\": \"ACTIVE\"}]"

}

If status is zero, there is some problem fetching the users.


Website Functions

1. Create Website


cyberpanel createWebsite --package Default --owner admin --domainName cyberpanel.net --email [email protected] --php 5.6

Optional Arguments


--ssl

--dkim

--openBasedir

Giving value 1 for option arguments enable these features, and 0 disables them.

2. Delete Website


cyberpanel deleteWebsite --domainName cyberpanel.net

Provided it is a website in CyberPanel and not a child domain.

3. Create Child Domain


cyberpanel createChild --masterDomain cyberpanel.net --childDomain child.cyberpanel.net --owner admin --php 5.6

Optional Arguments


--ssl

--dkim

--openBasedir

Giving value 1 for option arguments enable these features, and 0 disables them

4. Delete Child Domain


cyberpanel deleteChild --childDomain child.cyberpanel.net

This does not involve mentioning master domain for this child domain.

5. List Websites

There are two ways you can list websites, first is JSON format, and second is tabular format.

JSON Format


cyberpanel listWebsitesJson

This will give you JSON output.

Tabular Output


cyberpanel listWebsitesPretty

You will be getting tabular output like:

6. Change PHP


cyberpanel changePHP --domainName cyberpanel.net --php 5.6

This can change PHP for Websites as well as their child domains.

7. Change Package


cyberpanel changePackage --domainName cyberpanel.net --packageName CLI

The domain name should be a master domain since child domains do not need a package.


DNS Functions

1. List DNS Zones

There are two ways you can list dns zones, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listDNSZonesJson

This will give you JSON output.

Tabular Output


cyberpanel listDNSZonesPretty

2. List DNS Records

There are two ways you can list dns records, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listDNSJson --domainName cyberpanel.net

This will give you JSON output.

Tabular Output


cyberpanel listDNSPretty --domainName cyberpanel.net

3. Create DNS Zone


cyberpanel createDNSZone --owner admin --domainName cyberpanel.net

This created DNS zone as well as populate with most basic DNS records (A, CNAME, MX, SPF, DMARC, DKIM).

4. Delete DNS Zone


cyberpanel deleteDNSZone --domainName cyberpanel.net

5. Create DNS Record

Before creating DNS record, make sure this zone is already created, follow the guide to create the dns zone.


cyberpanel createDNSRecord --domainName cyberpanel.net --name cyberpanel.net --recordType A --value 192.168.100.1 --priority 0 --ttl 3600

–recordType → A, MX, CNAME, TXT and all those supported by CyberPanel GUI.

6. Delete DNS Record

You need Record ID before you can delete a DNS record, to obtain Record IDs for records related to a DNS zone, you can use list dns records command.


cyberpanel listDNSPretty --domainName cyberpanel.net

The first column gives the Record ID. Then you can use Record ID to delete the record.


cyberpanel deleteDNSRecord --recordID 200


Backup Functions

1. Create Backup


cyberpanel createBackup --domainName cyberpanel.net

This process will not exit until the backup process is completed, meanwhile, the status will be printed back to the screen.

2. Restore Backup


cyberpanel restoreBackup --fileName filename

Please note that backup file can be the absolute path to the backup file, or just the file name if the file resides in /home/backup

So if your backup file resides in /home/domain.com/backup/backupfile.tar.gz you will need to give the complete absolute path, otherwise, the file will not be detected.


Package Functions

1. Create Package


cyberpanel createPackage --owner admin --packageName CLI --diskSpace 1000 --bandwidth 10000 --emailAccounts 100 --dataBases 100 --ftpAccounts 100 --allowedDomains 100

This will create a package named CLI.


--allowedDomains - Allowed Child Domains.

--ftpAccounts - Number of allowed FTP Accounts.

--dataBases - Number of allowed Databases.

--emailAccounts - Number of allowed Email accounts.

Disk space and bandwidth are in MBs, but you do not need to append MB.

2. Delete Package


cyberpanel deletePackage --packageName CLI

Will delete a package named CLI.

3. List Packages

There are two ways you can list Packages, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listPackagesJson

This will give you JSON output.

Tabular Output


cyberpanel listPackagesPretty


Database Functions

1. Create Database


cyberpanel createDatabase --databaseWebsite cyberpanel.net --dbName cyberpanel --dbUsername cyberpanel --dbPassword cyberpanel

2. Delete Database


cyberpanel deleteDatabase --dbName cyberpanel

3. List Databases

There are two ways you can list Databases, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listDatabasesJson --databaseWebsite cyberpanel.net

This will give you JSON output.

Tabular Output


cyberpanel listDatabasesPretty --databaseWebsite cyberpanel.net


Email Functions

1. Create Email


cyberpanel createEmail --domainName cyberpanel.net --userName cyberpanel --password cyberpanel

2. Delete Email


cyberpanel deleteEmail --email [email protected]

3. Change Email Password


cyberpanel changeEmailPassword --email [email protected] --password cyberpanel

4. List Emails

There are two ways you can list Emails, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listEmailsJson --domainName cyberpanel.net

This will give you JSON output.

Tabular Output


cyberpanel listEmailsPretty --domainName cyberpanel.net


FTP Functions

1. Create FTP Account


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

Please note that final username of FTP account will be owner_Username. For example in this case admin_cyberpanel.

2. Delete FTP Account


cyberpanel deleteFTPAccount --userName cyberpanel

3. Change FTP Password


cyberpanel changeFTPPassword --userName cyberpanel --password cyberpanel

4. List FTP Accounts

There are two ways you can list FTP Accounts, first is JSON format, and second is the tabular format.

JSON Format


cyberpanel listFTPJson --domainName cyberpanel.net

This will give you JSON output.

Tabular Output


cyberpanel listFTPPretty --domainName cyberpanel.net


SSL Functions

1. Issue SSL


cyberpanel issueSSL --domainName cyberpanel.net

Can issue SSL for Master as well as Child Domains.

2. Hostname SSL


cyberpanel hostNameSSL --domainName cyberpanel.net

3. Mail Server SSL


cyberpanel mailServerSSL --domainName cyberpanel.net

5 Likes

I think I remember seeing cyberpanel commands for installing “addons” e.g. memcached that were available on installation. do you have list of these?

Suspend/Un-Suspend Website function is missing.
When will this be added

what the correct way to add SRV via command line? and someone show me an example

Please add using the CyberPanel add/delete record option.

Please add Create/delete/ssl Domain Aliases via cli.
Thanks.

2 Likes

How do we set the path for an FTP account? I tried adding a variety of paths using --path but it always just defaults to home.

  1. Create Child Domain is missing the paramenter to provide a custom path.
1 Like

What does --securityLevel do?

hello guys does anyone know the command to show the cyberpanel access data by ssh?
in aapanel the command is bt, but in cyberpanel I don’t know does anyone know?

How to restart only the services?

For example, when Htaccess changes we need to restart OLS, how to do this via cli?

Manually restart:
systemctl restart lsws

Give me a hint how to access this CLI from php file?

I tried using exec/shell_exec with stdout 2>&1, an error message = “cyberpanel: Permission denied” appears.

I tried to check with the “whoami” syntax to find out which user is using php, a user appears.

How do I make that user can access the command “cyberpanel …” ?

Thanks for the hint.

DONE.
After looking for information all day, I finally found a solution using phpseclib

Thank you!

Do you think it’s possible to fire Website deployment via the CLI tool? or maybe the WebHooks via the CLI?

I changed the port in the Dashboard, but now I lost access to it, how can I restore only the port setting via SSH?

I’m also waiting for this. I’m still waiting for one of my functional proposal

The functions allowing you to retrieve information on 1 user, 1 website or having all the websites for a given user are missing

how about addtional apache as reverse proxy. i can’t find the command sir.