PasswordLab Restore Guide
This guide explains how to restore your PasswordLab system from backups, including the database, configuration file, binary, and systemd service file. Follow these steps for a complete recovery after disaster or migration.
1. Connect to Your Server
-
SSH into your server:
ssh root@your-server-ip
-
Copy back all previously backed-up files from your backup archive, whether stored locally, on a remote server, or in the cloud.
Verify that MariaDB is installed and running, a new database is created, and you have valid credentials ready for use. If MariaDB is not installed on your server, follow the MariaDB installation guide
2. Restore Database
Restore the database using mysqldump backup:
mysql -u [db_username] -p [db_name] < /root/passwordlab-database-backup-YYYYMMDD.sql
Replace [db_username], [db_name], and the backup filename as needed.
3. Restore Configuration File
Create the configuration directory if it doesn't exist:
Copy the configuration backup to its location:
cp /root/passwordlab-config-backup-YYYYMMDD.json /etc/passwordlab/passwordlab.json
Adjust the filename to match your backup date.
mkdir -p /etc/passwordlab
4. Restore PasswordLab Binary
Copy the binary backup to its location:
cp /root/passwordlab-binary-backup-YYYYMMDD /usr/local/bin/passwordlab
Adjust the filename to match your backup date.
Assign the correct permissions to the binary:
chown root:root /usr/local/bin/passwordlab chmod 755 /usr/local/bin/passwordlab
4. Restore Systemd Service File
Copy the systemd service backup to its location:
cp /root/passwordlab-service-backup-YYYYMMDD.service /etc/systemd/system/passwordlab.service
Adjust the filename to match your backup date.
Reload systemd and restart the service:
systemctl daemon-reload systemctl restart passwordlab systemctl status passwordlab
Enable the service to start on boot:
systemctl enable passwordlab
5. Verify Restoration
- Check PasswordLab web app and login functionality
- Check service status: systemctl status passwordlab
- Check logs for errors: journalctl -u passwordlab -f
Best Practices
- Always restore to a test environment before production
- Verify all restored files and database contents
- Keep backup files secure and access-controlled