Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created August 19, 2024 10:52
Show Gist options
  • Save MohamedElashri/5b37b20ff60f57df8c4f929e2ea02e58 to your computer and use it in GitHub Desktop.
Save MohamedElashri/5b37b20ff60f57df8c4f929e2ea02e58 to your computer and use it in GitHub Desktop.
How to Reset a User's Password in Homarr on Proxmox LXC
#!/usr/bin/env bash
# Access the LXC container
pct enter <container_id>
# Navigate to the Homarr installation directory
cd /opt/homarr
# Access the SQLite database
sqlite3 /opt/homarr/database
# Inspect the user table
PRAGMA table_info(user);
# Run Python script to generate a new password hash
python3 -c "
import bcrypt
import uuid
new_password = uuid.uuid4().hex
salt = bcrypt.gensalt(rounds=10)
hashed_password = bcrypt.hashpw(new_password.encode('utf-8'), salt)
print(f'New password: {new_password}')
print(f'Hashed password: {hashed_password.decode('utf-8')}')
"
# Update the password in the database (within SQLite)
UPDATE user SET password = 'new_hashed_password' WHERE name = 'your_username';
# Restart Homarr service
systemctl restart homarr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment