← til

Encrypting and decrypting a folder

April 21, 2020
unix

In order to encrypt a folder, we'll create an archive of it and apply AES 256 bit encryption, using $PASS as a password:

tar cz * \
| openssl enc -aes-256-cbc -e -pass pass:$PASS \
> archive.tar.gz.enc

In order to decrypt it use the following command:

openssl enc -aes-256-cbc -d -in archive.tar.gz.enc -out archive.tar.gz