Technical Guides

Administrator matching query does not exist in CyberPanel

How to resolve the 'Administrator matching query does not exist' error in CyberPanel by creating a new admin user.

cyberpaneladministratorauthenticationdjangosuperuser

You have successfully debugged CyberPanel and executed the upgrade script. As a result, the main page is now operational; however, you are currently unable to log in for an unknown reason. If you take a moment to open the response section in your browser’s developer tools, you may observe the following console log:

{userID: 0, loginStatus: 0, error_message: "Administrator matching query does not exist."}

Understanding the Error

The error message “Administrator matching query does not exist” generally signifies that there is no admin user present in the database, or the credentials of the existing admin user do not match.

Solution: Creating a New Admin User

To resolve this issue, you will need to create a new admin user. You can accomplish this by following these steps:

Step 1: Navigate to CyberPanel Directory

cd /usr/local/CyberCP

Step 2: Create a Superuser

Execute the command to create a superuser:

python manage.py createsuperuser

After running the command, you will be prompted to create a new user. You will have the opportunity to select both the username and password, which will allow you to regain access to your admin dashboard.

Step 3: Provide User Information

You will be requested for the following information:

  • Username (leave blank to use ‘root’):
  • Email address:
  • Password:
  • Password (again):

Step 4: Restart the Service

Once you complete these steps, you should see the message: “Superuser created successfully.” Afterward, restart the lscpd service to apply the changes:

systemctl restart lscpd

This process will enable you to log back into your admin dashboard with the newly created credentials.

Alternative Method: Using CyberPanel’s Built-in Command

If the standard Django createsuperuser command doesn’t work properly with CyberPanel’s specific requirements, you can also try using CyberPanel’s built-in user creation command:

cyberpanel createUser --firstName Admin --lastName User --email admin@yourdomain.com --userName admin --password your_secure_password --websitesLimit 0 --selectedACL admin --securityLevel HIGH

This command ensures that the user is created with proper CyberPanel permissions and settings.

Verification

After creating the new admin user, you can verify that the user was created successfully by checking the database:

cd /usr/local/CyberCP
python manage.py shell

Then run:

from django.contrib.auth.models import User
users = User.objects.all()
for user in users:
    print(f"Username: {user.username}, Email: {user.email}, Is Superuser: {user.is_superuser}")

This will display all users in the system and confirm that your new admin user exists with superuser privileges.

This article is part of a comprehensive guide on CyberPanel authentication issues. You may also want to read:

This related article provides additional troubleshooting steps and diagnostic procedures for CyberPanel authentication problems.

Related Articles