0

I encrypt a file with gpg, the receiver is myself.

After reboot, I can less the gpg file directly with decrypted content, but cat/gvim/gedit show binary content.

Why less has this function? automatic decrypt with gnome-keying?

▶ file pw.gpg 
pw.gpg: PGP RSA encrypted session key ....
1

less can use a helper program to decode files for display. This is configured using the LESSOPEN environment variable; see

echo $LESSOPEN

Typically this uses a helper called lesspipe.

See the “input preprocessor” section of the less manpage for details.

In your case, the helper uses gpg to decrypt the file, and gpg gets your key from the agent (the keyring).

  • As long as this is a normal process, so good. I was just worried about the possibility that someone would be so easy to take my contents. – utopic eexpress Apr 4 '17 at 7:10
  • @utopiceexpress, FYI it is very easy to extract you content by mistake with less, for example with the s command. Better not use less for opening gpg files or run it in secure mode. But I don't find a way to run it in secure mode only when opening gpg files. – akostadinov Oct 10 '17 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.