It’s always recommended to backup your data for safety, but for safety AND security let’s encrypt your backups!
to compress and encrypt with ‘mypassword’:
tar -Jcf - directory | openssl aes-256-cbc -salt -k mypassword -out backup.tar.xz.aes
to decrypt and decompress:
openssl aes-256-cbc -d -salt -k mypassword -in backup.tar.xz.aes | tar -xJ -f -
Another trick with the tar command is useful for remote backups:
tar -zcvfp - /wwwdata | ssh root@remote.server.com "cat > /backup/wwwdata.tar.gz"