How to configure GNU Privacy Guard (GPG) and create a encrypted file

GNU Privacy Guard - (GPG)

GnuPG is an implementation of the OpenPGP standard (also known as PGP). For more information and documentation, see the GnuPG site.


By default, this utility is available in almost all of the Linux/Unix operating systems.

  1. To verify if the GPG utility is installed, run the command which gpg. In general, you should find it in /usr/bin/.




  2. To create a GPG key, run the following command:


    At the prompt, specify the kind of key you want, or press Enter to accept the default RSA and RSA.


  3. Enter the desired key size. Talend recommends the maximum key size of 4096.



  4. Enter the length of time the key should be valid. Press Enter to specify the default selection, indicating that the key doesn't expire (0).

  5. Enter the Real name (enter any name, at least 5 characters are required).

  6. Provide the email id (any vaild email id can be provided).


    Verify that your selections are correct.


  7. Type the letter O for Okay.

  8. Provide a passphrase. Using at least eight characters is recommended as a best practice.



  9. You will be prompted to type the passphrase again.

  10. Verify that the key was generated successfully by running the following command:




Now that you have created the key, you can encrypt any file by following these steps.

  1. Create a simple text file and enter any data, for example Hi, this is gpg encryption test.
  2. Encrypt the file using the following syntax:

    gpg --batch --yes --recipient user-id --output Absolute path/XXX.pgp –encrypt Absolute path/xxxxxx.txt

    For example, this command will create a file named test.pgp:

    gpg --batch --yes --recipient --output /root/Talend6.3.1/test.pgp --encrypt /root/Talend6.3.1/test.txt


  3. You can verify the file running the command:

    gpg -d Absolute path/test.pgp


    You will be prompted to provide the passphrase you used while creating the GPG key:


Version history
Revision #:
8 of 8
Last update:
‎04-13-2019 12:33 PM
Updated by: