# Break Into VirtFusion Software If Admin Password Is Lost

<p class="callout warning"><span style="color: rgb(0, 0, 0);">This **will not** be successful if you have **lost the 2FA** for the only administration user. The login will be changed to the new password and you can get into the first stage of the process, but you'll be sent to **/tfa/verify**, and if you don't have the 2FA code, you're outta luck.</span>  
  
<span style="color: rgb(0, 0, 0);">This is useful for first time installations where you lost the login box that appears on final install or if you need to get into an administrator account in an emergency.</span></p>

<span style="color: rgb(0, 0, 0);">Go onto the Hypervisor Control server and create a python script below, like **nano new-password.py**. Update the password here line with your relevant new password.</span>

```python
import bcrypt

# Replace with the new password for Jasmine
password = "<PASSWORD-HERE>"

# Generate a bcrypt hash with cost factor 12
salt = bcrypt.gensalt(rounds=10)
hashed_password = bcrypt.hashpw(password.encode(), salt)

# Print the hash
print(hashed_password.decode())
```

<span style="color: rgb(0, 0, 0);">Run the python script with **python3 new-password.py**. You should see it print it in bcrypt hash. </span>

<span style="color: rgb(0, 0, 0);">![image.png](https://docs.jasmeow.systems/uploads/images/gallery/2025-01/scaled-1680-/FUaKCr0lvb8W5cEj-image.png)</span>

<span style="color: rgb(0, 0, 0);">We now need to update the database. Run **cat /opt/virtfusion/app/control/.env**. We need the database name. Now head into MySQL, normally just being **mysql** in the terminal.</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/1kTrOz.png)</span>

<span style="color: rgb(0, 0, 0);">Type **use** **&lt;DB-NAME&gt;** you located earlier.</span>

<span style="color: rgb(0, 0, 0);">![](https://jasmeow.pics/mkIxuN.png)</span>

<span style="color: rgb(0, 0, 0);">Run **select \* from users** and you need to find the email you wish to update. </span>![](https://jasmeow.pics/aBc2I3.png)  
  
<span style="color: rgb(0, 0, 0);">In our example, we'll use Jasmine's email. Now run the following to fix the user:</span>

```markdown
UPDATE users
SET password = '<PASSWORD>'
WHERE email = '<EMAIL>';
```

<span style="color: rgb(0, 0, 0);">This should be successful with no issues:</span>

<span style="color: rgb(0, 0, 0);">![image.png](https://docs.jasmeow.systems/uploads/images/gallery/2025-01/scaled-1680-/6RMj1rpN4chf92UP-image.png)</span>

<span style="color: rgb(0, 0, 0);">You can now login to VirtFusion normally using this new password. Make sure to clear any cookies before signing in. There's a potential that it will be caching any session you have, so also use incognito.</span>