Jump to content

Featured Replies

Posted

You are reading Part 12 of the 57-part series: Harden and Secure Linux Servers. [Level 2]

This series covers progressive security measures, from fundamental hardening techniques to enterprise-grade defense strategies. Each article delves into a specific security practice, explaining its importance and providing step-by-step guidance for implementation.

To explore more security best practices, visit the main guide for a full breakdown of all levels and recommendations.

1. Use rsync for File Backups

rsync is a powerful tool that syncs files and directories between locations.

  • Backup to a local directory:

    rsync -av --delete /important_data /backup_location
    
    • -a → Preserves file attributes (permissions, timestamps).

    • -v → Enables verbose output.

    • --delete → Removes deleted files from the backup to match the source.

  • Backup to a remote server:

    rsync -avz /important_data username@remote_server:/backup_location
    

    (Replace username@remote_server with your backup server details.)

  • Automate backups with a cron job:

    crontab -e
    

    Add the following line to schedule daily backups at 2 AM:

    0 2 * * * rsync -av --delete /important_data /backup_location
    
2. Use tar for Compressed Backups

If you prefer compressed backups, use tar:

  • Create a compressed archive:

    tar -czvf /backup_location/backup_$(date +%F).tar.gz /important_data
    

    (This creates a timestamped backup file.)

  • Automate it with a cron job:

    0 3 * * * tar -czvf /backup_location/backup_$(date +%F).tar.gz /important_data
    

    (Runs daily at 3 AM.)

3. Use Timeshift for System Snapshots (Desktop & Server Users)

If you're using Ubuntu/Debian, Timeshift allows automated system snapshots for quick recovery.

  • Install Timeshift:

    sudo apt install timeshift -y
    
  • Open the configuration:

    sudo timeshift --create --comments "Daily Backup" --tags D
    
  • Set up automated snapshots:

    sudo timeshift --schedule
    
4. Use Cloud-Based Backup Solutions (Optional)

For extra security, offsite backups are recommended:
Google Drive / Dropbox / OneDrive → Use rclone to sync:

rclone sync /important_data remote:backup_location

AWS S3 / Google Cloud Storage / Backblaze B2 → Automate uploads using CLI tools.
Dedicated Backup Servers → Use tools like BorgBackup or Duplicity for encrypted backups.

Best Practices for Backup Security

Use at least the 3-2-1 backup rule:

  • 3 copies of your data

  • 2 different storage types (local + remote)

  • 1 offsite backup (cloud or external drive)

Encrypt sensitive backups using gpg or openssl:

tar -czvf - /important_data | openssl enc -aes-256-cbc -e -out backup.tar.gz.enc

(Encrypts the backup with AES-256 encryption.)

Test backups regularly to verify they work:

tar -tzvf /backup_location/backup_2024-01-18.tar.gz

(Lists the contents of a backup to confirm integrity.)

By scheduling automated backups, encrypting sensitive data, and storing copies offsite, you protect your system from data loss and ensure business continuity in case of an emergency.

  • Views 87
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.