3

Say I am using only one encryption key most the time.

How do I set the default encryption key in order to avoid mentioning it in the encryption command

In other word, I want this command:

gpg -e

to be equivalent to the command with the recipient

gpg -e -r reciever@mail.edu
user123456
  • 191
  • 1
  • 9

1 Answers1

5

GnuPG knows the --default-recipient option, which does exactly what you're looking for.

--default-recipient name
      Use name as default recipient if option --recipient is not used and don't
      ask if this is a valid one. name must be non-empty.

You can specify all GnuPG options in your GnuPG configuration file gpg.conf by omitting the -- prefix, for example

default-recipient reciever@mail.edu
Jens Erat
  • 17,507
  • 14
  • 61
  • 74
  • 1
    "... and don't ask if this is a valid one" is a confusing wording... at least in my opinion. – Ini Dec 30 '18 at 13:56
  • @Ini you're not alone in your opinion; it sounds like an imperative clause. My guess at what it means is "the given `name` is not validated like many of the other options that take names." – Ezekiel Victor Dec 06 '21 at 09:27