Blog | G5 Cyber Security

Remote APFS Backups via Samba: Security & Best Practice

TL;DR

Backing up to a remote encrypted APFS drive mounted through Samba can work, but it’s not the most secure or reliable solution. It introduces several potential weaknesses. We’ll outline how to do it if you must, and then discuss much better alternatives.

Is this a sound plan?

Generally, no. Mounting an APFS volume over Samba adds complexity and security risks compared to dedicated backup protocols like rsync over SSH or using cloud-based solutions designed for backups. Samba isn’t built with the specific requirements of data integrity and consistency that backups need.

If you *must* use Samba, here’s how (with warnings)

  1. Encryption: Ensure your APFS volume is encrypted using FileVault. This protects the data at rest on the remote drive.
  2. Samba Configuration (Server – Remote Drive): Configure Samba with strong user authentication and access controls.
    • Use a dedicated backup user account with limited privileges. Do not use an administrator account.
    • Restrict write access to only the specific share folder where backups will be stored.
    • Enable SMB signing (smb.conf):
      global security = domain
         signatures required = yes
      
  3. Samba Configuration (Client – Backup Machine): Configure the client machine to securely connect to the Samba share.
    • Use a strong password for the backup user.
    • Mount the share using your username and password, but consider storing credentials in a secure configuration file if scripting backups. Avoid hardcoding passwords directly into scripts.
  4. Backup Software: Use a robust backup software solution that supports incremental backups.
    • rsync: This is the best option if you’re comfortable with the command line. It efficiently copies only changed files and can be scripted for automated backups.
      rsync -avz --delete /source/folder username@remote_server:/path/to/backup/share
      
    • Time Machine (with caveats): Time Machine can back up to a network share, but it’s less reliable over Samba. Expect potential performance issues and data corruption risks. It’s not officially supported for Samba shares.
  5. Regular Verification: Regularly test your backups by restoring files from the remote drive. This is crucial to ensure data integrity.

Why this isn’t ideal & Better Alternatives

Better Alternatives:

Final Thoughts

While backing up to a remote encrypted APFS drive via Samba is technically possible, it’s not recommended due to the inherent risks involved. Prioritize more secure and reliable backup solutions like rsync over SSH or dedicated backup software whenever possible.

Exit mobile version