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

  1. SSH into your server:

    ssh root@your-server-ip
  2. Copy back all previously backed-up files from your backup archive, whether stored locally, on a remote server, or in the cloud.

  3. 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

  1. 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

  1. Create the configuration directory if it doesn't exist:

  2. mkdir -p /etc/passwordlab
  3. 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.

4. Restore PasswordLab Binary

  1. 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.

  2. 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

  1. 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.

  2. Reload systemd and restart the service:

    systemctl daemon-reload
    systemctl restart passwordlab
    systemctl status passwordlab
  3. Enable the service to start on boot:

    systemctl enable passwordlab

5. Verify Restoration

Best Practices