This method securely deletes remote content on a Hetzner Storage Box by syncing an empty directory over the target path using the --delete
flag in rsync
.
π Disclaimer
- Replace the dummy placeholders in this guide with your real Storage Box username, path, or SSH port.
- This operation is destructive β the contents at the remote path will be permanently deleted.
π§° Requirements
- SSH access to the Storage Box
rsync
installed on the local server- An empty directory (to overwrite remote contents)
π Step-by-Step Guide
- Create an empty directory on your local server (if it doesnβt already exist):
mkdir -p /root/emptydir
- Run
rsync
with the--delete
option to remove remote data:rsync -aP --delete -e "ssh -p 23" /root/emptydir/ [email protected]:/home/location/path/to/delete/
β Example with dummy data:rsync -aP --delete -e "ssh -p 23" /root/emptydir/ [email protected]:/home/my-backups/jetbackup/server123/
π§Ό What This Does
- Syncs an empty directory to the remote path.
- The
--delete
flag tellsrsync
to remove any files in the destination directory that donβt exist in the source (which is empty). - After execution, the specified remote path will be emptied of all files.
π Security Tip
After deleting the data, you may want to:
- Rotate the Storage Box password (via Hetzner control panel)
- Remove any SSH key if used
- Verify deletion using:
ssh -p 23 [email protected] "ls -lah /home/location/path/to/delete/"