Encrypting file in linux GPG

Encrypting a file in linux

To encrypt single file, use command gpg as follows:
$ gpg -c filename

To encrypt myfinancial.info file, type the command:
$ gpg -c myfinancial.info

Enter passphrase:<YOUR-PASSWORD>
Repeat passphrase:<YOUR-PASSWORD>

This will create a myfinancial.info.gpg file.

-c : Encrypt with symmetric cipher.

Caution if you ever forgot your password aka passphrase, you cannot
recover the data as it use very strong encryption.
Task: decrypt file

To decrypt file use gpg command:
$ gpg myfinancial.info.gpg

gpg myfinancial.info.gpg
gpg: CAST5 encrypted data
Enter passphrase:<YOUR-PASSWORD>

Decrypt file and write output to file vivek.info.txt you can run command:
$ gpg myfinancial.info.gpg –o vivek.info.txt