Create, encrypt and transfer archives over SSH with practical, secure commands. 16.11.2025 | reading time: 2 min Want to move tarballs or full backups to a remote server without exposing data or breaking permissions; this guide shows how to package an archive, transfer it over SSH and check the result using concrete commands. Deploy a nightly backup Create an archive, copy it to a backup host and confirm arrival with these commands and their typical output. ```bash # create a gzipped tarball with a date in the name tar -czf /tmp/www-backup-$(date +%F).tar.gz -C /var/www . # securely copy to the backup server (default SSH port) scp /tmp/www-backup-$(date +%F).tar.gz backup@192.0.2.10:/backups/ # verify remotely that the file exists ssh backup@192.0.2.10 "ls -l /backups/www-backup-$(date +%F).tar.gz" ``` Example of condensed output one might see after the commands above: ```text www-backup-2025-11-16.tar.gz 100% 12MB 00:05 0.2MB/s -rw-r--r-- 1 backup backup 12582912 Nov 16 12:05 /backups/www-backup-2025-11-16.tar.gz ``` Hardening and tuning Preserve timestamps and permissions with `-p` on scp or `tar --numeric-owner`; force compression with `-C` on scp to save bandwidth; specify nonstandard SSH ports with `-P`; prefer key-based auth and `ssh-agent` over passwords and use `ssh-copy-id` to install a public key quickly; for sensitive data encrypt the archive first with GPG before transfer using `gpg --symmetric` so the file is protected even if storage is compromised. Alternatives that scale For incremental or resumable transfers use `rsync -e ssh` which sends only changed blocks; SFTP is preferable for interactive or GUI-driven workflows and supports resuming; scp works for simple single-file copies but for large, repeated or bandwidth-limited transfers choose rsync or SFTP to save time and avoid broken transfers. Next steps Practice creating encrypted archives and moving them to a test server, then automate with a cron job or systemd timer; master these techniques and pursue formal Linux certification such as CompTIA Linux+ or LPIC-1 for structured learning, and consider bitsandbytes.academy for intensive exam preparation. Join Bits & Bytes Academy First class LINUX exam preparation. security network backup utilities storage