πŸ“˜How to Delete Data from a Hetzner Storage Box via SSH and rsync

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

  1. Create an empty directory on your local server (if it doesn’t already exist): mkdir -p /root/emptydir
  2. 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 tells rsync 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/"
Scroll to Top