Traditional backups often fail during ransomware attacks because attackers can delete, encrypt, or modify backup data.
A ransomware-resistant backup system must ensure that even root cannot alter backup files once written.
This guide explains how to build an immutable backup architecture on Linux using:
File system immutability
Append-only storage
Permission isolation
Snapshot-based protection
This approach is widely used in enterprises but rarely documented in a single, practical guide.

This design protects against:
Root-level ransomware
Accidental deletion
Insider threats
Automated crypto-malware
Ubuntu / Debian
RHEL / AlmaLinux / Rocky
SUSE
Arch Linux
Production Server
|
| (rsync / ssh)
v
Backup Server
├── Immutable Backup Directory
├── Append-only files
├── Snapshot layer
└── Offline retention
Create backup user:
useradd -m -s /sbin/nologin backupuser
passwd backupuser
Create backup directory:
mkdir -p /backups/servers
chown backupuser:backupuser /backups/servers
chmod 750 /backups/servers
Apply append-only flag:
chattr +a /backups/servers
Verify:
lsattr /backups
Files can only be appended
Cannot be modified or deleted
Even root must explicitly remove attribute
Restrict root access:
chmod 700 /backups/servers
Prevent accidental writes:
setfacl -m u:backupuser:rwx /backups/servers
If backups are on LVM:
lvcreate -L 10G -s -n backup_snap /dev/vg0/backups
Mount snapshot:
mount -o ro /dev/vg0/backup_snap /mnt/backup_snap
This provides secondary protection against data loss.
From production server:
rsync -aAXHv \
--numeric-ids \
--link-dest=/backups/servers/previous \
/data/ backupuser@backup-server:/backups/servers/current
Hard links reduce space usage and preserve history.
Once backup completes:
chattr +i /backups/servers/current
Cannot modify
Cannot delete
Cannot rename
Immune to ransomware
During scheduled rotation:
chattr -i /backups/servers/current
mv /backups/servers/current /backups/servers/2026-01-28
chattr +i /backups/servers/2026-01-28
Only the backup automation window has write access.
Replicate immutable backups:
rsync -a --numeric-ids /backups/servers remote-backup:/vault/servers
Use pull-only model from remote side.
Verify immutability:
rm -rf /backups/servers/current
Expected result:
Operation not permitted
Check attributes:
lsattr /backups/servers/current
Temporarily unlock:
chattr -i /backups/servers/2026-01-28
Restore:
rsync -aAXHv /backups/servers/2026-01-28/ /restore/
Re-lock immediately after restore.
Never mount backup storage on production servers
Use pull-based backups where possible
Rotate immutability keys carefully
Test restore procedures quarterly
Combine with offline backups
Leaving backups writable permanently
Storing backups on same filesystem
No snapshot layer
No off-site copy
Ransomware protection
Compliance (ISO, SOC2, HIPAA)
Hosting providers
Financial systems
Government infrastructure
By combining append-only storage, immutable attributes, and snapshots, Linux administrators can create a ransomware-resistant backup system that remains safe even during full system compromise.
This architecture is enterprise-proven but rarely documented in a complete, practical manner.