How To Encrypt A File With OpenSSL

GPG is the fist utilty that most admins think of when they need to encrypt some data at reast. However, it is not very simple to quickly encrypt a file with a password.

OpenSSL makes this much easier.

The following command will encrypt a file:

$ openssl enc -aes-256-cbc -salt -in <FILE> -out <ENCRYPTED-FILE>
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:

Unencrypt the file with the folloing command:

$ openssl enc -aes-256-cbc -d -in <ENCRYPTED-FILE> -out <FILE>
enter aes-256-cbc decryption password: