Many Linux users today use compression formatting strictly for backup purposes. Even though it compresses the backups well, it doesn’t necessarily secure the backup. You need to either encrypt the backup or add a password. Here is an easy way to secure your backups when creating an archive. I am naming the backup “todays_backup”.
To compress the directory, please follow along:
# tar -zcf todays_backup.tar.gz todays_backup
This command compresses the directory into a compressed file. If you need to decompress enter:
# tar -zxf todays_backup.tar.gz
When you desire to add a simple level of encryption, enter:
# tar -zcf – todays_backup|openssl des3 -salt -k yourpassword | dd of=todays_backup.des3
Replace “yourpassword” with one of your own. Obviously, keep the password in a safe place, remembering where you place it. How to decompress using your new password; extract the archive todays_backup.des3 by entering:
# dd if= todays_backup.des3 |openssl des3 -d -k yourpassword |tar zxf -
Please note the end—it’s not an error or typo but a necessary requirement for the command to work properly. Replace yourpassword with the same one that you used when you encrypted the file. When you use that command, it will extract the file into a todays_backup directory. Please use the encrypted file carefully and secure the password. It is almost impossible to recover.
Related posts:












Blog