Reset Admin Password

This document explains how to reset a user's password if you lose administrative access to LXDMosaic.


Procedure

Access the host or container where LXDMosaic is running:

bash
# Access the LXDMosaic container/host
lxc exec lxdMosaic bash

# Generate a password hash using PHP
php -r 'echo password_hash("YOUR_NEW_PASSWORD", PASSWORD_DEFAULT) . "\n";'
# Example output:
# $2y$10$ctUEvACAfuVDbh/u23blBur/OLJgVxkiJF65Dy1EA4IOq0xCB8q3a

# Copy the generated hash — you will need it in the next step

Then update the password in the database:

bash
# Access the MySQL shell
mysql -u root

# Select the LXDMosaic database
mysql> USE LXD_Manager;

# Find the user ID of the account you want to reset
mysql> SELECT `User_ID`, `User_Name` FROM `Users`;

# +---------+-----------+
# | User_ID | User_Name |
# +---------+-----------+
# | 1       | admin     |
# +---------+-----------+

# Update the password with the hash generated above
mysql> UPDATE `Users` SET `User_Password` = '$2y$10$ctUEvACAfuVDbh/u23blBur/OLJgVxkiJF65Dy1EA4IOq0xCB8q3a' WHERE `User_ID` = 1;

# Verify and exit
mysql> EXIT;

You can now log in with the new password.