Encrypt backup files with OpenSSL


I’ve come up with the idea of saving ESXi backups on off-site locations. But before saving full VM backups in the cloud for example, I want the files to be encrypted so nobody else can use or see them.
The easiest way of encrypting would be to use the well known OpenSSL, so this is how I did it with a bash script.

Create a file that contains your encrypt/decrypt password, like echo 'yourstrongpassword' ~/.password.

It’s good to know how to decrypt the backups too, this is how you do it with OpenSSL
openssl aes-256-cbc -pass file:/path/to/.password -d -in /path/to/encrypted_file.enc | tar xz