How to set the default GPG encryption key?

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

Posted 2017-03-19T22:05:03.187

Reputation: 181

Answers

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

Posted 2017-03-19T22:05:03.187

Reputation: 14 141

"... and don't ask if this is a valid one" is a confusing wording... at least in my opinion. – Ini – 2018-12-30T13:56:20.817